mirror of
https://github.com/sasjs/core.git
synced 2026-01-16 04:50:05 +00:00
feat: new mcf_init.sas macro to handle function compilation tracking (and associated test). Further updates to support mp_stackdiffs test results so far
This commit is contained in:
@@ -5,18 +5,19 @@
|
|||||||
|
|
||||||
%put %mf_getfilesize(fpath=C:\temp\myfile.txt);
|
%put %mf_getfilesize(fpath=C:\temp\myfile.txt);
|
||||||
|
|
||||||
or
|
or, provide a libds value as follows:
|
||||||
|
|
||||||
data x;do x=1 to 100000;y=x;output;end;run;
|
data x;do x=1 to 100000;y=x;output;end;run;
|
||||||
%put %mf_getfilesize(libds=work.x,format=yes);
|
%put %mf_getfilesize(libds=work.x,format=yes);
|
||||||
|
|
||||||
gives:
|
Which gives:
|
||||||
|
|
||||||
2mb
|
> 2mb
|
||||||
|
|
||||||
|
@param [in] fpath= Full path and filename. Provide this OR the libds value.
|
||||||
|
@param [in] libds= (0) Library.dataset value (assumes library is BASE engine)
|
||||||
|
@param [in] format= (NO) Set to yes to apply sizekmg. format
|
||||||
|
|
||||||
@param fpath= full path and filename. Provide this OR the libds value.
|
|
||||||
@param libds= library.dataset value (assumes library is BASE engine)
|
|
||||||
@param format= set to yes to apply sizekmg. format
|
|
||||||
@returns bytes
|
@returns bytes
|
||||||
|
|
||||||
@version 9.2
|
@version 9.2
|
||||||
@@ -26,16 +27,32 @@
|
|||||||
%macro mf_getfilesize(fpath=,libds=0,format=NO
|
%macro mf_getfilesize(fpath=,libds=0,format=NO
|
||||||
)/*/STORE SOURCE*/;
|
)/*/STORE SOURCE*/;
|
||||||
|
|
||||||
%if &libds ne 0 %then %do;
|
%local rc fid fref bytes dsid lib vnum;
|
||||||
%let fpath=%sysfunc(pathname(%scan(&libds,1,.)))/%scan(&libds,2,.).sas7bdat;
|
|
||||||
%end;
|
|
||||||
|
|
||||||
%local rc fid fref bytes;
|
%if &libds ne 0 %then %do;
|
||||||
%let rc=%sysfunc(filename(fref,&fpath));
|
%let libds=%upcase(&libds);
|
||||||
%let fid=%sysfunc(fopen(&fref));
|
%if %index(&libds,.)=0 %then %let lib=WORK;
|
||||||
%let bytes=%sysfunc(finfo(&fid,File Size (bytes)));
|
%else %let lib=%scan(&libds,1,.);
|
||||||
%let rc=%sysfunc(fclose(&fid));
|
%let dsid=%sysfunc(open(
|
||||||
%let rc=%sysfunc(filename(fref));
|
sashelp.vtable(where=(libname="&lib" and memname="%scan(&libds,-1,.)")
|
||||||
|
keep=libname memname filesize
|
||||||
|
)
|
||||||
|
));
|
||||||
|
%if (&dsid ^= 0) %then %do;
|
||||||
|
%let vnum=%sysfunc(varnum(&dsid,FILESIZE));
|
||||||
|
%let rc=%sysfunc(fetch(&dsid));
|
||||||
|
%let bytes=%sysfunc(getvarn(&dsid,&vnum));
|
||||||
|
%let rc= %sysfunc(close(&dsid));
|
||||||
|
%end;
|
||||||
|
%else %put &sysmacroname: &libds could not be opened! %sysfunc(sysmsg());
|
||||||
|
%end;
|
||||||
|
%else %do;
|
||||||
|
%let rc=%sysfunc(filename(fref,&fpath));
|
||||||
|
%let fid=%sysfunc(fopen(&fref));
|
||||||
|
%let bytes=%sysfunc(finfo(&fid,File Size (bytes)));
|
||||||
|
%let rc=%sysfunc(fclose(&fid));
|
||||||
|
%let rc=%sysfunc(filename(fref));
|
||||||
|
%end;
|
||||||
|
|
||||||
%if &format=NO %then %do;
|
%if &format=NO %then %do;
|
||||||
&bytes
|
&bytes
|
||||||
|
|||||||
@@ -12,10 +12,6 @@
|
|||||||
|
|
||||||
%mp_assertdsobs(sashelp.class,test=ATMOST 20) %* pass if <21 obs present;
|
%mp_assertdsobs(sashelp.class,test=ATMOST 20) %* pass if <21 obs present;
|
||||||
|
|
||||||
<h4> SAS Macros </h4>
|
|
||||||
@li mf_nobs.sas
|
|
||||||
@li mp_abort.sas
|
|
||||||
|
|
||||||
|
|
||||||
@param [in] inds input dataset to test for presence of observations
|
@param [in] inds input dataset to test for presence of observations
|
||||||
@param [in] desc= (Testing observations) The user provided test description
|
@param [in] desc= (Testing observations) The user provided test description
|
||||||
@@ -33,6 +29,11 @@
|
|||||||
|---|---|---|
|
|---|---|---|
|
||||||
|User Provided description|PASS|Dataset &inds has XX obs|
|
|User Provided description|PASS|Dataset &inds has XX obs|
|
||||||
|
|
||||||
|
<h4> SAS Macros </h4>
|
||||||
|
@li mf_getuniquename.sas
|
||||||
|
@li mf_nobs.sas
|
||||||
|
@li mp_abort.sas
|
||||||
|
|
||||||
<h4> Related Macros </h4>
|
<h4> Related Macros </h4>
|
||||||
@li mp_assertcolvals.sas
|
@li mp_assertcolvals.sas
|
||||||
@li mp_assert.sas
|
@li mp_assert.sas
|
||||||
@@ -49,9 +50,10 @@
|
|||||||
outds=work.test_results
|
outds=work.test_results
|
||||||
)/*/STORE SOURCE*/;
|
)/*/STORE SOURCE*/;
|
||||||
|
|
||||||
%local nobs;
|
%local nobs ds;
|
||||||
%let nobs=%mf_nobs(&inds);
|
%let nobs=%mf_nobs(&inds);
|
||||||
%let test=%upcase(&test);
|
%let test=%upcase(&test);
|
||||||
|
%let ds=%mf_getuniquename(prefix=mp_assertdsobs);
|
||||||
|
|
||||||
%if %substr(&test.xxxxx,1,6)=EQUALS %then %do;
|
%if %substr(&test.xxxxx,1,6)=EQUALS %then %do;
|
||||||
%let val=%scan(&test,2,%str( ));
|
%let val=%scan(&test,2,%str( ));
|
||||||
@@ -84,7 +86,7 @@
|
|||||||
)
|
)
|
||||||
%end;
|
%end;
|
||||||
|
|
||||||
data;
|
data &ds;
|
||||||
length test_description $256 test_result $4 test_comments $256;
|
length test_description $256 test_result $4 test_comments $256;
|
||||||
test_description=symget('desc');
|
test_description=symget('desc');
|
||||||
test_result='FAIL';
|
test_result='FAIL';
|
||||||
@@ -110,9 +112,6 @@
|
|||||||
%end;
|
%end;
|
||||||
run;
|
run;
|
||||||
|
|
||||||
%local ds;
|
|
||||||
%let ds=&syslast;
|
|
||||||
|
|
||||||
proc append base=&outds data=&ds;
|
proc append base=&outds data=&ds;
|
||||||
run;
|
run;
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@
|
|||||||
|
|
||||||
%macro mp_ds2squeeze(
|
%macro mp_ds2squeeze(
|
||||||
libds,
|
libds,
|
||||||
outds=work.work.mp_ds2squeeze,
|
outds=work.mp_ds2squeeze,
|
||||||
mdebug=0
|
mdebug=0
|
||||||
)/*/STORE SOURCE*/;
|
)/*/STORE SOURCE*/;
|
||||||
%local dbg source;
|
%local dbg source;
|
||||||
@@ -62,9 +62,10 @@
|
|||||||
%let source=/source2;
|
%let source=/source2;
|
||||||
%end;
|
%end;
|
||||||
|
|
||||||
%local optval ds fref;
|
%local optval ds fref startsize;
|
||||||
%let ds=%mf_getuniquename();
|
%let ds=%mf_getuniquename();
|
||||||
%let fref=%mf_getuniquefileref();
|
%let fref=%mf_getuniquefileref();
|
||||||
|
%let startsize=%mf_getfilesize(libds=&libds,format=yes);
|
||||||
|
|
||||||
%mp_getmaxvarlengths(&libds,outds=&ds)
|
%mp_getmaxvarlengths(&libds,outds=&ds)
|
||||||
|
|
||||||
@@ -113,7 +114,7 @@ options varlenchk=&optval;
|
|||||||
filename &fref clear;
|
filename &fref clear;
|
||||||
%end;
|
%end;
|
||||||
|
|
||||||
%put &sysmacroname: &libds was %mf_getfilesize(libds=&libds,format=yes);
|
%put &sysmacroname: &libds was &startsize;
|
||||||
%put &sysmacroname: &outds is %mf_getfilesize(libds=&outds,format=yes);
|
%put &sysmacroname: &outds is %mf_getfilesize(libds=&outds,format=yes);
|
||||||
|
|
||||||
%mend mp_ds2squeeze;
|
%mend mp_ds2squeeze;
|
||||||
@@ -37,6 +37,7 @@
|
|||||||
|
|
||||||
%global
|
%global
|
||||||
SASJS_PREFIX /* the ONLY hard-coded global macro variable in SASjs */
|
SASJS_PREFIX /* the ONLY hard-coded global macro variable in SASjs */
|
||||||
|
&prefix._FUNCTIONS /* used in mcf_init() to track core function compilation */
|
||||||
&prefix._INIT_NUM /* initialisation time as numeric */
|
&prefix._INIT_NUM /* initialisation time as numeric */
|
||||||
&prefix._INIT_DTTM /* initialisation time in E8601DT26.6 format */
|
&prefix._INIT_DTTM /* initialisation time in E8601DT26.6 format */
|
||||||
&prefix.WORK /* avoid typing %sysfunc(pathname(work)) every time */
|
&prefix.WORK /* avoid typing %sysfunc(pathname(work)) every time */
|
||||||
|
|||||||
@@ -194,6 +194,7 @@
|
|||||||
@li mf_nobs.sas
|
@li mf_nobs.sas
|
||||||
@li mf_wordsinstr1butnotstr2.sas
|
@li mf_wordsinstr1butnotstr2.sas
|
||||||
@li mp_abort.sas
|
@li mp_abort.sas
|
||||||
|
@li mp_ds2squeeze.sas
|
||||||
|
|
||||||
|
|
||||||
<h4> Related Macros </h4>
|
<h4> Related Macros </h4>
|
||||||
@@ -298,11 +299,14 @@ proc transpose data=&ds1d(where=(tgtvar_type='C'))
|
|||||||
id TGTVAR_NM;
|
id TGTVAR_NM;
|
||||||
var OLDVAL_CHAR;
|
var OLDVAL_CHAR;
|
||||||
run;
|
run;
|
||||||
|
%mp_ds2squeeze(&ds2d,outds=&ds2d)
|
||||||
|
%mp_ds2squeeze(&ds3d,outds=&ds3d)
|
||||||
data &outdel;
|
data &outdel;
|
||||||
if 0 then set &baselibds;
|
if 0 then set &baselibds;
|
||||||
set &ds2d;
|
set &ds2d;
|
||||||
set &ds3d;
|
set &ds3d;
|
||||||
drop key_hash;
|
drop key_hash;
|
||||||
|
if not missing(%scan(&key,1));
|
||||||
run;
|
run;
|
||||||
proc sort;
|
proc sort;
|
||||||
by &key;
|
by &key;
|
||||||
@@ -328,11 +332,14 @@ proc transpose data=&ds1a(where=(tgtvar_type='C'))
|
|||||||
id TGTVAR_NM;
|
id TGTVAR_NM;
|
||||||
var NEWVAL_CHAR;
|
var NEWVAL_CHAR;
|
||||||
run;
|
run;
|
||||||
|
%mp_ds2squeeze(&ds2a,outds=&ds2a)
|
||||||
|
%mp_ds2squeeze(&ds3a,outds=&ds3a)
|
||||||
data &outadd;
|
data &outadd;
|
||||||
if 0 then set &baselibds;
|
if 0 then set &baselibds;
|
||||||
set &ds2a;
|
set &ds2a;
|
||||||
set &ds3a;
|
set &ds3a;
|
||||||
drop key_hash;
|
drop key_hash;
|
||||||
|
if not missing(%scan(&key,1));
|
||||||
run;
|
run;
|
||||||
proc sort;
|
proc sort;
|
||||||
by &key;
|
by &key;
|
||||||
@@ -359,10 +366,13 @@ proc transpose data=&ds1m(where=(tgtvar_type='C'))
|
|||||||
id TGTVAR_NM;
|
id TGTVAR_NM;
|
||||||
var NEWVAL_CHAR;
|
var NEWVAL_CHAR;
|
||||||
run;
|
run;
|
||||||
|
%mp_ds2squeeze(&ds2m,outds=&ds2m)
|
||||||
|
%mp_ds2squeeze(&ds3m,outds=&ds3m)
|
||||||
data &outmod;
|
data &outmod;
|
||||||
if 0 then set &baselibds;
|
if 0 then set &baselibds;
|
||||||
set &ds2m;
|
set &ds2m;
|
||||||
set &ds3m;
|
set &ds3m;
|
||||||
|
if not missing(%scan(&key,1));
|
||||||
run;
|
run;
|
||||||
proc sort;
|
proc sort;
|
||||||
by &key;
|
by &key;
|
||||||
@@ -375,6 +385,7 @@ run;
|
|||||||
* passthrough and a temporary table.
|
* passthrough and a temporary table.
|
||||||
*/
|
*/
|
||||||
data &pks;
|
data &pks;
|
||||||
|
if 0 then set &baselibds;
|
||||||
set &outadd &outmod &outdel;
|
set &outadd &outmod &outdel;
|
||||||
keep &key;
|
keep &key;
|
||||||
run;
|
run;
|
||||||
@@ -382,6 +393,10 @@ run;
|
|||||||
proc sort noduprec dupout=&dups;
|
proc sort noduprec dupout=&dups;
|
||||||
by &key;
|
by &key;
|
||||||
run;
|
run;
|
||||||
|
data _null_;
|
||||||
|
set &dups;
|
||||||
|
putlog (_all_)(=);
|
||||||
|
run;
|
||||||
%mp_abort(iftrue= (%mf_nobs(&dups) ne 0)
|
%mp_abort(iftrue= (%mf_nobs(&dups) ne 0)
|
||||||
,mac=&sysmacroname
|
,mac=&sysmacroname
|
||||||
,msg=%str(duplicates (%mf_nobs(&dups)) found on &auditlibds!)
|
,msg=%str(duplicates (%mf_nobs(&dups)) found on &auditlibds!)
|
||||||
@@ -542,17 +557,16 @@ select distinct tgtvar_nm into: missvars separated by ' '
|
|||||||
%let fref=%mf_getuniquefileref();
|
%let fref=%mf_getuniquefileref();
|
||||||
data _null_;
|
data _null_;
|
||||||
file &fref;
|
file &fref;
|
||||||
set &auditlibds(where=(move_type='D')) end=lastobs;
|
set &auditlibds(where=(move_type='M')) end=lastobs;
|
||||||
by key_hash;
|
by key_hash;
|
||||||
if _n_=1 then put 'proc sql;';
|
if _n_=1 then put 'proc sql;';
|
||||||
if first.key_hash then put "update &outmod set ";
|
if first.key_hash then put "update &outmod set ";
|
||||||
comma=ifc(first.key_hash=0,',',' ');
|
comma=ifc(first.key_hash=0,',',' ');
|
||||||
if tgtvar_type='C' then put ' ' comma TGTVAR_NM '=trim("' NEWVAL_CHAR '")';
|
if tgtvar_type='C' then put ' ' comma TGTVAR_NM '=trim("' NEWVAL_CHAR '")';
|
||||||
if last.key_hash then put ' where key_hash=trim("' key_hash '");';
|
if last.key_hash then put ' where key_hash=trim("' key_hash '");';
|
||||||
if lastobs then put 'alter &outmod drop key_hash';
|
if lastobs then put "alter table &outmod drop key_hash;";
|
||||||
run;
|
run;
|
||||||
%inc &fref/source2;
|
%inc &fref/source2;
|
||||||
|
|
||||||
%end;
|
%end;
|
||||||
|
|
||||||
%if &mdebug=0 %then %do;
|
%if &mdebug=0 %then %do;
|
||||||
|
|||||||
44
fcmp/mcf_init.sas
Normal file
44
fcmp/mcf_init.sas
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
/**
|
||||||
|
@file
|
||||||
|
@brief Sets up the mcf_xx functions
|
||||||
|
@details
|
||||||
|
There is no (efficient) way to determine if an mcf_xx macro has already been
|
||||||
|
invoked. So, we make use of a global macro variable list to keep track.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
|
||||||
|
%mcf_init(MCF_LENGTH)
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
> 1 (if already initialised) else 0
|
||||||
|
|
||||||
|
@param [in] func The function to be initialised
|
||||||
|
|
||||||
|
<h4> Related Macros </h4>
|
||||||
|
@li mcf_init.test.sas
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
%macro mcf_init(func
|
||||||
|
)/*/STORE SOURCE*/;
|
||||||
|
|
||||||
|
%if not (%symexist(SASJS_PREFIX)) %then %do;
|
||||||
|
%global SASJS_PREFIX;
|
||||||
|
%let SASJS_PREFIX=SASJS;
|
||||||
|
%end;
|
||||||
|
|
||||||
|
%let func=%upcase(&func);
|
||||||
|
|
||||||
|
/* the / character is just a seperator */
|
||||||
|
%global &sasjs_prefix._FUNCTIONS;
|
||||||
|
%if %index(&&&sasjs_prefix._FUNCTIONS,&func/)>0 %then %do;
|
||||||
|
1
|
||||||
|
%return;
|
||||||
|
%end;
|
||||||
|
%else %do;
|
||||||
|
%let &sasjs_prefix._FUNCTIONS=&&&sasjs_prefix._FUNCTIONS &func/;
|
||||||
|
0
|
||||||
|
%end;
|
||||||
|
|
||||||
|
%mend mcf_init;
|
||||||
@@ -40,10 +40,11 @@
|
|||||||
Uses a 3 part format: libref.catalog.package
|
Uses a 3 part format: libref.catalog.package
|
||||||
|
|
||||||
<h4> SAS Macros </h4>
|
<h4> SAS Macros </h4>
|
||||||
@li mf_existfunction.sas
|
@li mcf_init.sas
|
||||||
|
|
||||||
<h4> Related Macros </h4>
|
<h4> Related Programs </h4>
|
||||||
@li mcf_length.test.sas
|
@li mcf_length.test.sas
|
||||||
|
@li mp_init.sas
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
@@ -54,7 +55,7 @@
|
|||||||
,pkg=UTILS
|
,pkg=UTILS
|
||||||
)/*/STORE SOURCE*/;
|
)/*/STORE SOURCE*/;
|
||||||
|
|
||||||
%if %mf_existfunction(mcf_length)=1 %then %return;
|
%if %mcf_init(mcf_length)=1 %then %return;
|
||||||
|
|
||||||
%if &wrap=YES %then %do;
|
%if &wrap=YES %then %do;
|
||||||
proc fcmp outlib=&lib..&cat..&pkg;
|
proc fcmp outlib=&lib..&cat..&pkg;
|
||||||
|
|||||||
@@ -55,7 +55,11 @@
|
|||||||
Uses a 3 part format: libref.catalog.package
|
Uses a 3 part format: libref.catalog.package
|
||||||
|
|
||||||
<h4> SAS Macros </h4>
|
<h4> SAS Macros </h4>
|
||||||
@li mf_existfunction.sas
|
@li mcf_init.sas
|
||||||
|
|
||||||
|
<h4> Related Programs </h4>
|
||||||
|
@li mcf_stpsrv_header.test.sas
|
||||||
|
@li mp_init.sas
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
@@ -66,7 +70,7 @@
|
|||||||
,pkg=UTILS
|
,pkg=UTILS
|
||||||
)/*/STORE SOURCE*/;
|
)/*/STORE SOURCE*/;
|
||||||
|
|
||||||
%if %mf_existfunction(stpsrv_header)=1 %then %return;
|
%if %mcf_init(stpsrv_header)=1 %then %return;
|
||||||
|
|
||||||
%if &wrap=YES %then %do;
|
%if &wrap=YES %then %do;
|
||||||
proc fcmp outlib=&lib..&cat..&pkg;
|
proc fcmp outlib=&lib..&cat..&pkg;
|
||||||
|
|||||||
@@ -40,7 +40,11 @@
|
|||||||
Uses a 3 part format: libref.catalog.package
|
Uses a 3 part format: libref.catalog.package
|
||||||
|
|
||||||
<h4> SAS Macros </h4>
|
<h4> SAS Macros </h4>
|
||||||
@li mf_existfunction.sas
|
@li mcf_init.sas
|
||||||
|
|
||||||
|
<h4> Related Programs </h4>
|
||||||
|
@li mcf_stpsrv_header.test.sas
|
||||||
|
@li mp_init.sas
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
@@ -51,7 +55,7 @@
|
|||||||
,pkg=UTILS
|
,pkg=UTILS
|
||||||
)/*/STORE SOURCE*/;
|
)/*/STORE SOURCE*/;
|
||||||
|
|
||||||
%if %mf_existfunction(mcf_string2file)=1 %then %return;
|
%if %mcf_init(mcf_string2file)=1 %then %return;
|
||||||
|
|
||||||
%if &wrap=YES %then %do;
|
%if &wrap=YES %then %do;
|
||||||
proc fcmp outlib=&lib..&cat..&pkg;
|
proc fcmp outlib=&lib..&cat..&pkg;
|
||||||
|
|||||||
@@ -68,7 +68,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "server",
|
"name": "server",
|
||||||
"serverUrl": "https://sas.analytium.co.uk:5001",
|
"serverUrl": "https://sas.analytium.co.uk:5000",
|
||||||
"serverType": "SASJS",
|
"serverType": "SASJS",
|
||||||
"appLoc": "/Shared Data/temp/macrocore",
|
"appLoc": "/Shared Data/temp/macrocore",
|
||||||
"macroFolders": [
|
"macroFolders": [
|
||||||
|
|||||||
46
tests/crossplatform/mcf_init.test.sas
Normal file
46
tests/crossplatform/mcf_init.test.sas
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
/**
|
||||||
|
@file
|
||||||
|
@brief Testing mcf_init.sas macro
|
||||||
|
|
||||||
|
<h4> SAS Macros </h4>
|
||||||
|
@li mcf_init.sas
|
||||||
|
@li mp_assert.sas
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
%mp_assert(
|
||||||
|
iftrue=(%mcf_init(test)=0),
|
||||||
|
desc=Check if new func returns 0
|
||||||
|
)
|
||||||
|
%mp_assert(
|
||||||
|
iftrue=(&syscc=0),
|
||||||
|
desc=No errs on basic invocation
|
||||||
|
)
|
||||||
|
%mp_assert(
|
||||||
|
iftrue=(%mcf_init(test)=1),
|
||||||
|
desc=Check if second invocation returns 1
|
||||||
|
)
|
||||||
|
%mp_assert(
|
||||||
|
iftrue=(&syscc=0),
|
||||||
|
desc=No errs on second invocation
|
||||||
|
)
|
||||||
|
%mp_assert(
|
||||||
|
iftrue=(%mcf_init(test2)=0),
|
||||||
|
desc=Check if new invocation returns 0
|
||||||
|
)
|
||||||
|
%mp_assert(
|
||||||
|
iftrue=(%mcf_init(test2)=1),
|
||||||
|
desc=Check if second new invocation returns 1
|
||||||
|
)
|
||||||
|
%mp_assert(
|
||||||
|
iftrue=(%mcf_init(test)=1),
|
||||||
|
desc=Check original returns 1
|
||||||
|
)
|
||||||
|
%mp_assert(
|
||||||
|
iftrue=(%mcf_init(t)=0),
|
||||||
|
desc=Check subset returns 0
|
||||||
|
)
|
||||||
|
%mp_assert(
|
||||||
|
iftrue=(&syscc=0),
|
||||||
|
desc=No errs at end
|
||||||
|
)
|
||||||
31
tests/crossplatform/mf_getfilesize.test.sas
Normal file
31
tests/crossplatform/mf_getfilesize.test.sas
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
/**
|
||||||
|
@file
|
||||||
|
@brief Testing mf_getfilesize macro
|
||||||
|
|
||||||
|
<h4> SAS Macros </h4>
|
||||||
|
@li mf_getfilesize.sas
|
||||||
|
@li mp_assert.sas
|
||||||
|
@li mp_assertscope.sas
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
data test;
|
||||||
|
x=1;
|
||||||
|
run;
|
||||||
|
|
||||||
|
%mp_assertscope(SNAPSHOT)
|
||||||
|
%put %mf_getfilesize(libds=work.test)
|
||||||
|
%mp_assertscope(COMPARE)
|
||||||
|
|
||||||
|
%mp_assert(
|
||||||
|
iftrue=(&syscc=0),
|
||||||
|
desc=Checking syscc,
|
||||||
|
outds=work.test_results
|
||||||
|
)
|
||||||
|
|
||||||
|
%put %mf_getfilesize(libds=test)
|
||||||
|
%mp_assert(
|
||||||
|
iftrue=(&syscc=0),
|
||||||
|
desc=Checking syscc with one level name,
|
||||||
|
outds=work.test_results
|
||||||
|
)
|
||||||
@@ -32,7 +32,9 @@ data work.orig work.deleted work.changed work.appended;
|
|||||||
else stop;
|
else stop;
|
||||||
run;
|
run;
|
||||||
|
|
||||||
%mp_storediffs(sashelp.electric,work.orig,CUSTOMER YEAR
|
%mp_storediffs(sashelp.electric
|
||||||
|
,work.orig
|
||||||
|
,CUSTOMER YEAR
|
||||||
,delds=work.deleted
|
,delds=work.deleted
|
||||||
,modds=work.changed
|
,modds=work.changed
|
||||||
,appds=work.appended
|
,appds=work.appended
|
||||||
|
|||||||
@@ -14,6 +14,8 @@
|
|||||||
/* set defaults */
|
/* set defaults */
|
||||||
%mp_init()
|
%mp_init()
|
||||||
|
|
||||||
|
%global _debug;
|
||||||
|
|
||||||
%macro loglevel();
|
%macro loglevel();
|
||||||
%if "&_debug"="2477" or "&_debug"="fields,log,trace" %then %do;
|
%if "&_debug"="2477" or "&_debug"="fields,log,trace" %then %do;
|
||||||
%put debug mode activated;
|
%put debug mode activated;
|
||||||
|
|||||||
Reference in New Issue
Block a user