1
0
mirror of https://github.com/sasjs/core.git synced 2026-01-08 18:00:06 +00:00

fix: adding iftrue switch to mp_hashdataset

This commit is contained in:
munja
2021-12-08 20:58:59 +00:00
parent 6c8165601d
commit 3d3c76c836
2 changed files with 14 additions and 4 deletions

View File

@@ -6169,6 +6169,7 @@ create table &outds as
@param [in] libds dataset to hash @param [in] libds dataset to hash
@param [in] salt= Provide a salt (could be, for instance, the dataset name) @param [in] salt= Provide a salt (could be, for instance, the dataset name)
@param [in] iftrue= A condition under which the macro should be executed.
@param [out] outds= (work.mf_hashdataset) The output dataset to create. This @param [out] outds= (work.mf_hashdataset) The output dataset to create. This
will contain one column (hashkey) with one observation (a hex32. will contain one column (hashkey) with one observation (a hex32.
representation of the input hash) representation of the input hash)
@@ -6183,10 +6184,14 @@ create table &outds as
%macro mp_hashdataset( %macro mp_hashdataset(
libds, libds,
outds=, outds=,
salt= salt=,
iftrue=%str(1=1)
)/*/STORE SOURCE*/; )/*/STORE SOURCE*/;
%if not(%eval(%unquote(&iftrue))) %then %return;
%if %mf_getattrn(&libds,NLOBS)=0 %then %do; %if %mf_getattrn(&libds,NLOBS)=0 %then %do;
%put %str(WARN)ING: Dataset &libds is empty;, or is not a dataset; %put %str(WARN)ING: Dataset &libds is empty, or is not a dataset;
%end; %end;
%else %if %mf_getattrn(&libds,NLOBS)<0 %then %do; %else %if %mf_getattrn(&libds,NLOBS)<0 %then %do;
%put %str(ERR)OR: Dataset &libds is not a dataset; %put %str(ERR)OR: Dataset &libds is not a dataset;

View File

@@ -21,6 +21,7 @@
@param [in] libds dataset to hash @param [in] libds dataset to hash
@param [in] salt= Provide a salt (could be, for instance, the dataset name) @param [in] salt= Provide a salt (could be, for instance, the dataset name)
@param [in] iftrue= A condition under which the macro should be executed.
@param [out] outds= (work.mf_hashdataset) The output dataset to create. This @param [out] outds= (work.mf_hashdataset) The output dataset to create. This
will contain one column (hashkey) with one observation (a hex32. will contain one column (hashkey) with one observation (a hex32.
representation of the input hash) representation of the input hash)
@@ -35,10 +36,14 @@
%macro mp_hashdataset( %macro mp_hashdataset(
libds, libds,
outds=, outds=,
salt= salt=,
iftrue=%str(1=1)
)/*/STORE SOURCE*/; )/*/STORE SOURCE*/;
%if not(%eval(%unquote(&iftrue))) %then %return;
%if %mf_getattrn(&libds,NLOBS)=0 %then %do; %if %mf_getattrn(&libds,NLOBS)=0 %then %do;
%put %str(WARN)ING: Dataset &libds is empty;, or is not a dataset; %put %str(WARN)ING: Dataset &libds is empty, or is not a dataset;
%end; %end;
%else %if %mf_getattrn(&libds,NLOBS)<0 %then %do; %else %if %mf_getattrn(&libds,NLOBS)<0 %then %do;
%put %str(ERR)OR: Dataset &libds is not a dataset; %put %str(ERR)OR: Dataset &libds is not a dataset;