mirror of
https://github.com/sasjs/core.git
synced 2026-01-07 17:40:05 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6d2fc7e265 | ||
|
|
39b2e7c5f9 |
9
all.sas
9
all.sas
@@ -4419,8 +4419,8 @@ run;
|
|||||||
)/*/STORE SOURCE*/;
|
)/*/STORE SOURCE*/;
|
||||||
|
|
||||||
/* check fileref is assigned */
|
/* check fileref is assigned */
|
||||||
%if %mf_existfileref(&outref)=0 %then %do;
|
%if %mf_existfileref(&fref)=0 %then %do;
|
||||||
filename &outref temp ;
|
filename &fref temp ;
|
||||||
%end;
|
%end;
|
||||||
|
|
||||||
%if %length(&libref)=0 %then %let libref=WORK;
|
%if %length(&libref)=0 %then %let libref=WORK;
|
||||||
@@ -5158,8 +5158,7 @@ create table &outds (rename=(
|
|||||||
@li mf_getvartype.sas
|
@li mf_getvartype.sas
|
||||||
|
|
||||||
@param [in] libds dataset to hash
|
@param [in] libds dataset to hash
|
||||||
@param [in] salt= Provide a salt (could be, for instance, the name of the
|
@param [in] salt= Provide a salt (could be, for instance, the dataset name)
|
||||||
dataset). Max 32 chars.
|
|
||||||
@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)
|
||||||
@@ -5194,7 +5193,7 @@ create table &outds (rename=(
|
|||||||
%let varlist=%mf_getvarlist(&libds);
|
%let varlist=%mf_getvarlist(&libds);
|
||||||
data &outds(rename=(&keyvar=hashkey) keep=&keyvar);
|
data &outds(rename=(&keyvar=hashkey) keep=&keyvar);
|
||||||
length &prevkeyvar &keyvar $32;
|
length &prevkeyvar &keyvar $32;
|
||||||
retain &prevkeyvar "&salt";
|
retain &prevkeyvar "%sysfunc(md5(%str(&salt)),$hex32.)";
|
||||||
set &libds end=&lastvar;
|
set &libds end=&lastvar;
|
||||||
/* hash should include previous row */
|
/* hash should include previous row */
|
||||||
&keyvar=put(md5(&prevkeyvar
|
&keyvar=put(md5(&prevkeyvar
|
||||||
|
|||||||
@@ -38,8 +38,8 @@
|
|||||||
)/*/STORE SOURCE*/;
|
)/*/STORE SOURCE*/;
|
||||||
|
|
||||||
/* check fileref is assigned */
|
/* check fileref is assigned */
|
||||||
%if %mf_existfileref(&outref)=0 %then %do;
|
%if %mf_existfileref(&fref)=0 %then %do;
|
||||||
filename &outref temp ;
|
filename &fref temp ;
|
||||||
%end;
|
%end;
|
||||||
|
|
||||||
%if %length(&libref)=0 %then %let libref=WORK;
|
%if %length(&libref)=0 %then %let libref=WORK;
|
||||||
|
|||||||
@@ -20,8 +20,7 @@
|
|||||||
@li mf_getvartype.sas
|
@li mf_getvartype.sas
|
||||||
|
|
||||||
@param [in] libds dataset to hash
|
@param [in] libds dataset to hash
|
||||||
@param [in] salt= Provide a salt (could be, for instance, the name of the
|
@param [in] salt= Provide a salt (could be, for instance, the dataset name)
|
||||||
dataset). Max 32 chars.
|
|
||||||
@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)
|
||||||
@@ -56,7 +55,7 @@
|
|||||||
%let varlist=%mf_getvarlist(&libds);
|
%let varlist=%mf_getvarlist(&libds);
|
||||||
data &outds(rename=(&keyvar=hashkey) keep=&keyvar);
|
data &outds(rename=(&keyvar=hashkey) keep=&keyvar);
|
||||||
length &prevkeyvar &keyvar $32;
|
length &prevkeyvar &keyvar $32;
|
||||||
retain &prevkeyvar "&salt";
|
retain &prevkeyvar "%sysfunc(md5(%str(&salt)),$hex32.)";
|
||||||
set &libds end=&lastvar;
|
set &libds end=&lastvar;
|
||||||
/* hash should include previous row */
|
/* hash should include previous row */
|
||||||
&keyvar=put(md5(&prevkeyvar
|
&keyvar=put(md5(&prevkeyvar
|
||||||
|
|||||||
23
tests/base/mp_getddl.test.sas
Normal file
23
tests/base/mp_getddl.test.sas
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
/**
|
||||||
|
@file
|
||||||
|
@brief Testing mp_getddl.sas macro
|
||||||
|
|
||||||
|
<h4> SAS Macros </h4>
|
||||||
|
@li mp_getddl.sas
|
||||||
|
@li mp_assert.sas
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
data test(index=(pk=(x y)/unique /nomiss));
|
||||||
|
x=1;
|
||||||
|
y='blah';
|
||||||
|
label x='blah';
|
||||||
|
run;
|
||||||
|
proc sql; describe table &syslast;
|
||||||
|
%mp_getddl(work,test,flavour=tsql,showlog=YES)
|
||||||
|
|
||||||
|
%mp_assert(
|
||||||
|
iftrue=(&syscc=0),
|
||||||
|
desc=mp_getddl runs without errors,
|
||||||
|
outds=work.test_results
|
||||||
|
)
|
||||||
Reference in New Issue
Block a user