mirror of
https://github.com/sasjs/core.git
synced 2026-01-13 03:20:06 +00:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7f587ba720 | ||
|
|
21ecc1b675 | ||
|
|
6b13dc2b87 | ||
|
|
bb89184212 | ||
|
|
56338caaca | ||
|
|
d7e2ff8ac9 | ||
|
|
582ec0a1f9 | ||
|
|
53785f5644 |
@@ -217,6 +217,15 @@ If you find this library useful, please leave a [star](https://github.com/sasjs/
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
## Other SAS Repositories
|
||||||
|
|
||||||
|
The following repositories are also worth checking out:
|
||||||
|
|
||||||
|
* [chris-swenson/sasmacros](https://github.com/chris-swenson/sasmacros)
|
||||||
|
* [greg-wotton/sas-programs](https://github.com/greg-wootton/sas-programs)
|
||||||
|
* [KatjaGlassConsulting/SMILE-SmartSASMacros](https://github.com/KatjaGlassConsulting/SMILE-SmartSASMacros)
|
||||||
|
* [scottbass/sas](https://github.com/scottbass/SAS)
|
||||||
|
* [yabwon/sas_packages](https://github.com/yabwon/SAS_PACKAGES)
|
||||||
|
|
||||||
## Contributors ✨
|
## Contributors ✨
|
||||||
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
||||||
|
|||||||
82
all.sas
82
all.sas
@@ -167,19 +167,17 @@ options noquotelenmax;
|
|||||||
|
|
||||||
%put %mf_existfeature(PROCLUA);
|
%put %mf_existfeature(PROCLUA);
|
||||||
|
|
||||||
@param feature the feature to detect. Leave blank to list all in log.
|
@param [in] feature The feature to detect.
|
||||||
|
|
||||||
@return output returns 1 or 0 (or -1 if not found)
|
@return output returns 1 or 0 (or -1 if not found)
|
||||||
|
|
||||||
<h4> SAS Macros </h4>
|
<h4> SAS Macros </h4>
|
||||||
@li mf_getplatform.sas
|
@li mf_getplatform.sas
|
||||||
|
|
||||||
|
|
||||||
@version 8
|
@version 8
|
||||||
@author Allan Bowe
|
@author Allan Bowe
|
||||||
**/
|
**/
|
||||||
/** @cond */
|
/** @cond */
|
||||||
|
|
||||||
%macro mf_existfeature(feature
|
%macro mf_existfeature(feature
|
||||||
)/*/STORE SOURCE*/;
|
)/*/STORE SOURCE*/;
|
||||||
%let feature=%upcase(&feature);
|
%let feature=%upcase(&feature);
|
||||||
@@ -187,7 +185,11 @@ options noquotelenmax;
|
|||||||
%let platform=%mf_getplatform();
|
%let platform=%mf_getplatform();
|
||||||
|
|
||||||
%if &feature= %then %do;
|
%if &feature= %then %do;
|
||||||
%put Supported features: PROCLUA;
|
%put No feature was requested for detection;
|
||||||
|
%end;
|
||||||
|
%else %if &feature=COLCONSTRAINTS %then %do;
|
||||||
|
%if %substr(&sysver,1,1)=4 %then 0;
|
||||||
|
%else 1;
|
||||||
%end;
|
%end;
|
||||||
%else %if &feature=PROCLUA %then %do;
|
%else %if &feature=PROCLUA %then %do;
|
||||||
/* https://blogs.sas.com/content/sasdummy/2015/08/03/using-lua-within-your-sas-programs */
|
/* https://blogs.sas.com/content/sasdummy/2015/08/03/using-lua-within-your-sas-programs */
|
||||||
@@ -201,8 +203,8 @@ options noquotelenmax;
|
|||||||
%put &sysmacroname: &feature not found;
|
%put &sysmacroname: &feature not found;
|
||||||
%end;
|
%end;
|
||||||
%mend mf_existfeature;
|
%mend mf_existfeature;
|
||||||
|
/** @endcond */
|
||||||
/** @endcond *//**
|
/**
|
||||||
@file
|
@file
|
||||||
@brief Checks whether a fileref exists
|
@brief Checks whether a fileref exists
|
||||||
@details You can probably do without this macro as it is just a one liner.
|
@details You can probably do without this macro as it is just a one liner.
|
||||||
@@ -2192,7 +2194,7 @@ Usage:
|
|||||||
%end;
|
%end;
|
||||||
|
|
||||||
/* Stored Process Server web app context */
|
/* Stored Process Server web app context */
|
||||||
%if %symexist(_metaperson)
|
%if %symexist(_metaport)
|
||||||
or "&SYSPROCESSNAME "="Compute Server "
|
or "&SYSPROCESSNAME "="Compute Server "
|
||||||
or &mode=INCLUDE
|
or &mode=INCLUDE
|
||||||
%then %do;
|
%then %do;
|
||||||
@@ -2367,7 +2369,8 @@ Usage:
|
|||||||
%end;
|
%end;
|
||||||
%mend mp_abort;
|
%mend mp_abort;
|
||||||
|
|
||||||
/** @endcond *//**
|
/** @endcond */
|
||||||
|
/**
|
||||||
@file
|
@file
|
||||||
@brief Append (concatenate) two or more files.
|
@brief Append (concatenate) two or more files.
|
||||||
@details Will append one more more `appendrefs` (filerefs) to a `baseref`.
|
@details Will append one more more `appendrefs` (filerefs) to a `baseref`.
|
||||||
@@ -8768,7 +8771,7 @@ run;
|
|||||||
* First, extract only relevant formats from the catalog
|
* First, extract only relevant formats from the catalog
|
||||||
*/
|
*/
|
||||||
proc sql noprint;
|
proc sql noprint;
|
||||||
select distinct fmtname into: fmtlist separated by ' ' from &libds;
|
select distinct upcase(fmtname) into: fmtlist separated by ' ' from &libds;
|
||||||
|
|
||||||
%mp_cntlout(libcat=&libcat,fmtlist=&fmtlist,cntlout=&base_fmts)
|
%mp_cntlout(libcat=&libcat,fmtlist=&fmtlist,cntlout=&base_fmts)
|
||||||
|
|
||||||
@@ -8778,8 +8781,11 @@ select distinct fmtname into: fmtlist separated by ' ' from &libds;
|
|||||||
*/
|
*/
|
||||||
%mddl_sas_cntlout(libds=&template)
|
%mddl_sas_cntlout(libds=&template)
|
||||||
data &inlibds;
|
data &inlibds;
|
||||||
|
length &delete_col $3;
|
||||||
if 0 then set &template;
|
if 0 then set &template;
|
||||||
set &libds;
|
set &libds;
|
||||||
|
if &delete_col='' then &delete_col='No';
|
||||||
|
fmtname=upcase(fmtname);
|
||||||
if missing(type) then do;
|
if missing(type) then do;
|
||||||
if substr(fmtname,1,1)='$' then type='C';
|
if substr(fmtname,1,1)='$' then type='C';
|
||||||
else type='N';
|
else type='N';
|
||||||
@@ -8790,7 +8796,6 @@ data &inlibds;
|
|||||||
end;
|
end;
|
||||||
run;
|
run;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Identify new records
|
* Identify new records
|
||||||
*/
|
*/
|
||||||
@@ -8897,7 +8902,7 @@ options ibufsize=&ibufsize;
|
|||||||
%end;
|
%end;
|
||||||
|
|
||||||
%mp_storediffs(&libcat-FC
|
%mp_storediffs(&libcat-FC
|
||||||
,&inlibds
|
,&base_fmts
|
||||||
,FMTNAME START
|
,FMTNAME START
|
||||||
,delds=&outds_del
|
,delds=&outds_del
|
||||||
,modds=&outds_mod
|
,modds=&outds_mod
|
||||||
@@ -18864,9 +18869,10 @@ run;
|
|||||||
,mdebug=0
|
,mdebug=0
|
||||||
);
|
);
|
||||||
|
|
||||||
%local fname0 fname1 boundary fname statcd msg;
|
%local fname0 fname1 fname2 boundary fname statcd msg;
|
||||||
%let fname0=%mf_getuniquefileref();
|
%let fname0=%mf_getuniquefileref();
|
||||||
%let fname1=%mf_getuniquefileref();
|
%let fname1=%mf_getuniquefileref();
|
||||||
|
%let fname2=%mf_getuniquefileref();
|
||||||
%let boundary=%mf_getuniquename();
|
%let boundary=%mf_getuniquename();
|
||||||
|
|
||||||
data _null_;
|
data _null_;
|
||||||
@@ -18890,17 +18896,25 @@ data _null_;
|
|||||||
end;
|
end;
|
||||||
run;
|
run;
|
||||||
|
|
||||||
|
data _null_;
|
||||||
|
file &fname1;
|
||||||
|
put "Content-Type: multipart/form-data; boundary=&boundary";
|
||||||
|
run;
|
||||||
|
|
||||||
%if &mdebug=1 %then %do;
|
%if &mdebug=1 %then %do;
|
||||||
data _null_;
|
data _null_;
|
||||||
infile &fname0;
|
infile &fname0;
|
||||||
input;
|
input;
|
||||||
put _infile_;
|
put _infile_;
|
||||||
|
data _null_;
|
||||||
|
infile &fname1;
|
||||||
|
input;
|
||||||
|
put _infile_;
|
||||||
run;
|
run;
|
||||||
%end;
|
%end;
|
||||||
|
|
||||||
proc http method='POST' in=&fname0 out=&fname1
|
proc http method='POST' in=&fname0 headerin=&fname1 out=&fname2
|
||||||
url="&_sasjs_apiserverurl/SASjsApi/drive/file";
|
url="&_sasjs_apiserverurl/SASjsApi/drive/file";
|
||||||
headers "Content-Type"="multipart/form-data; boundary=&boundary";
|
|
||||||
%if &mdebug=1 %then %do;
|
%if &mdebug=1 %then %do;
|
||||||
debug level=1;
|
debug level=1;
|
||||||
%end;
|
%end;
|
||||||
@@ -18908,7 +18922,7 @@ run;
|
|||||||
|
|
||||||
%let statcd=0;
|
%let statcd=0;
|
||||||
data _null_;
|
data _null_;
|
||||||
infile &fname1;
|
infile &fname2;
|
||||||
input;
|
input;
|
||||||
putlog _infile_;
|
putlog _infile_;
|
||||||
if _infile_='{"status":"success"}' then call symputx('statcd',1,'l');
|
if _infile_='{"status":"success"}' then call symputx('statcd',1,'l');
|
||||||
@@ -18922,6 +18936,41 @@ run;
|
|||||||
)
|
)
|
||||||
|
|
||||||
%mend ms_createfile;
|
%mend ms_createfile;
|
||||||
|
/**
|
||||||
|
@file
|
||||||
|
@brief Deletes a file from SASjs Drive
|
||||||
|
@details Deletes a file from SASjs Drive, if it exists.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
filename stpcode temp;
|
||||||
|
data _null_;
|
||||||
|
file stpcode;
|
||||||
|
put '%put hello world;';
|
||||||
|
run;
|
||||||
|
%ms_createfile(/some/stored/program.sas, inref=stpcode)
|
||||||
|
|
||||||
|
%ms_deletefile(/some/stored/program.sas)
|
||||||
|
|
||||||
|
@param [in] driveloc The full path to the file in SASjs Drive
|
||||||
|
@param [in] mdebug= (0) Set to 1 to enable DEBUG messages
|
||||||
|
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
%macro ms_deletefile(driveloc
|
||||||
|
,mdebug=0
|
||||||
|
);
|
||||||
|
|
||||||
|
proc http method='DELETE'
|
||||||
|
url="&_sasjs_apiserverurl/SASjsApi/drive/file?_filePath=&driveloc";
|
||||||
|
%if &mdebug=1 %then %do;
|
||||||
|
debug level=2;
|
||||||
|
%end;
|
||||||
|
run;
|
||||||
|
|
||||||
|
|
||||||
|
%mend ms_deletefile;
|
||||||
/**
|
/**
|
||||||
@file
|
@file
|
||||||
@brief Gets a file from SASjs Drive
|
@brief Gets a file from SASjs Drive
|
||||||
@@ -18946,7 +18995,7 @@ run;
|
|||||||
filename &outref temp;
|
filename &outref temp;
|
||||||
|
|
||||||
proc http method='GET' out=&outref
|
proc http method='GET' out=&outref
|
||||||
url="&_sasjs_apiserverurl/SASjsApi/drive/file?filePath=&driveloc";
|
url="&_sasjs_apiserverurl/SASjsApi/drive/file?_filePath=&driveloc";
|
||||||
%if &mdebug=1 %then %do;
|
%if &mdebug=1 %then %do;
|
||||||
debug level=2;
|
debug level=2;
|
||||||
%end;
|
%end;
|
||||||
@@ -21087,6 +21136,7 @@ libname &libref1a clear;
|
|||||||
|
|
||||||
<h4> SAS Macros </h4>
|
<h4> SAS Macros </h4>
|
||||||
@li mp_abort.sas
|
@li mp_abort.sas
|
||||||
|
@li mf_existds.sas
|
||||||
@li mf_getplatform.sas
|
@li mf_getplatform.sas
|
||||||
@li mf_getuniquefileref.sas
|
@li mf_getuniquefileref.sas
|
||||||
@li mf_getuniquelibref.sas
|
@li mf_getuniquelibref.sas
|
||||||
|
|||||||
@@ -9,19 +9,17 @@
|
|||||||
|
|
||||||
%put %mf_existfeature(PROCLUA);
|
%put %mf_existfeature(PROCLUA);
|
||||||
|
|
||||||
@param feature the feature to detect. Leave blank to list all in log.
|
@param [in] feature The feature to detect.
|
||||||
|
|
||||||
@return output returns 1 or 0 (or -1 if not found)
|
@return output returns 1 or 0 (or -1 if not found)
|
||||||
|
|
||||||
<h4> SAS Macros </h4>
|
<h4> SAS Macros </h4>
|
||||||
@li mf_getplatform.sas
|
@li mf_getplatform.sas
|
||||||
|
|
||||||
|
|
||||||
@version 8
|
@version 8
|
||||||
@author Allan Bowe
|
@author Allan Bowe
|
||||||
**/
|
**/
|
||||||
/** @cond */
|
/** @cond */
|
||||||
|
|
||||||
%macro mf_existfeature(feature
|
%macro mf_existfeature(feature
|
||||||
)/*/STORE SOURCE*/;
|
)/*/STORE SOURCE*/;
|
||||||
%let feature=%upcase(&feature);
|
%let feature=%upcase(&feature);
|
||||||
@@ -29,7 +27,11 @@
|
|||||||
%let platform=%mf_getplatform();
|
%let platform=%mf_getplatform();
|
||||||
|
|
||||||
%if &feature= %then %do;
|
%if &feature= %then %do;
|
||||||
%put Supported features: PROCLUA;
|
%put No feature was requested for detection;
|
||||||
|
%end;
|
||||||
|
%else %if &feature=COLCONSTRAINTS %then %do;
|
||||||
|
%if %substr(&sysver,1,1)=4 %then 0;
|
||||||
|
%else 1;
|
||||||
%end;
|
%end;
|
||||||
%else %if &feature=PROCLUA %then %do;
|
%else %if &feature=PROCLUA %then %do;
|
||||||
/* https://blogs.sas.com/content/sasdummy/2015/08/03/using-lua-within-your-sas-programs */
|
/* https://blogs.sas.com/content/sasdummy/2015/08/03/using-lua-within-your-sas-programs */
|
||||||
@@ -43,5 +45,4 @@
|
|||||||
%put &sysmacroname: &feature not found;
|
%put &sysmacroname: &feature not found;
|
||||||
%end;
|
%end;
|
||||||
%mend mf_existfeature;
|
%mend mf_existfeature;
|
||||||
|
|
||||||
/** @endcond */
|
/** @endcond */
|
||||||
@@ -85,7 +85,7 @@
|
|||||||
%end;
|
%end;
|
||||||
|
|
||||||
/* Stored Process Server web app context */
|
/* Stored Process Server web app context */
|
||||||
%if %symexist(_metaperson)
|
%if %symexist(_metaport)
|
||||||
or "&SYSPROCESSNAME "="Compute Server "
|
or "&SYSPROCESSNAME "="Compute Server "
|
||||||
or &mode=INCLUDE
|
or &mode=INCLUDE
|
||||||
%then %do;
|
%then %do;
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ run;
|
|||||||
* First, extract only relevant formats from the catalog
|
* First, extract only relevant formats from the catalog
|
||||||
*/
|
*/
|
||||||
proc sql noprint;
|
proc sql noprint;
|
||||||
select distinct fmtname into: fmtlist separated by ' ' from &libds;
|
select distinct upcase(fmtname) into: fmtlist separated by ' ' from &libds;
|
||||||
|
|
||||||
%mp_cntlout(libcat=&libcat,fmtlist=&fmtlist,cntlout=&base_fmts)
|
%mp_cntlout(libcat=&libcat,fmtlist=&fmtlist,cntlout=&base_fmts)
|
||||||
|
|
||||||
@@ -144,8 +144,11 @@ select distinct fmtname into: fmtlist separated by ' ' from &libds;
|
|||||||
*/
|
*/
|
||||||
%mddl_sas_cntlout(libds=&template)
|
%mddl_sas_cntlout(libds=&template)
|
||||||
data &inlibds;
|
data &inlibds;
|
||||||
|
length &delete_col $3;
|
||||||
if 0 then set &template;
|
if 0 then set &template;
|
||||||
set &libds;
|
set &libds;
|
||||||
|
if &delete_col='' then &delete_col='No';
|
||||||
|
fmtname=upcase(fmtname);
|
||||||
if missing(type) then do;
|
if missing(type) then do;
|
||||||
if substr(fmtname,1,1)='$' then type='C';
|
if substr(fmtname,1,1)='$' then type='C';
|
||||||
else type='N';
|
else type='N';
|
||||||
@@ -156,7 +159,6 @@ data &inlibds;
|
|||||||
end;
|
end;
|
||||||
run;
|
run;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Identify new records
|
* Identify new records
|
||||||
*/
|
*/
|
||||||
@@ -263,7 +265,7 @@ options ibufsize=&ibufsize;
|
|||||||
%end;
|
%end;
|
||||||
|
|
||||||
%mp_storediffs(&libcat-FC
|
%mp_storediffs(&libcat-FC
|
||||||
,&inlibds
|
,&base_fmts
|
||||||
,FMTNAME START
|
,FMTNAME START
|
||||||
,delds=&outds_del
|
,delds=&outds_del
|
||||||
,modds=&outds_mod
|
,modds=&outds_mod
|
||||||
|
|||||||
@@ -29,9 +29,10 @@
|
|||||||
,mdebug=0
|
,mdebug=0
|
||||||
);
|
);
|
||||||
|
|
||||||
%local fname0 fname1 boundary fname statcd msg;
|
%local fname0 fname1 fname2 boundary fname statcd msg;
|
||||||
%let fname0=%mf_getuniquefileref();
|
%let fname0=%mf_getuniquefileref();
|
||||||
%let fname1=%mf_getuniquefileref();
|
%let fname1=%mf_getuniquefileref();
|
||||||
|
%let fname2=%mf_getuniquefileref();
|
||||||
%let boundary=%mf_getuniquename();
|
%let boundary=%mf_getuniquename();
|
||||||
|
|
||||||
data _null_;
|
data _null_;
|
||||||
@@ -55,17 +56,25 @@ data _null_;
|
|||||||
end;
|
end;
|
||||||
run;
|
run;
|
||||||
|
|
||||||
|
data _null_;
|
||||||
|
file &fname1;
|
||||||
|
put "Content-Type: multipart/form-data; boundary=&boundary";
|
||||||
|
run;
|
||||||
|
|
||||||
%if &mdebug=1 %then %do;
|
%if &mdebug=1 %then %do;
|
||||||
data _null_;
|
data _null_;
|
||||||
infile &fname0;
|
infile &fname0;
|
||||||
input;
|
input;
|
||||||
put _infile_;
|
put _infile_;
|
||||||
|
data _null_;
|
||||||
|
infile &fname1;
|
||||||
|
input;
|
||||||
|
put _infile_;
|
||||||
run;
|
run;
|
||||||
%end;
|
%end;
|
||||||
|
|
||||||
proc http method='POST' in=&fname0 out=&fname1
|
proc http method='POST' in=&fname0 headerin=&fname1 out=&fname2
|
||||||
url="&_sasjs_apiserverurl/SASjsApi/drive/file";
|
url="&_sasjs_apiserverurl/SASjsApi/drive/file";
|
||||||
headers "Content-Type"="multipart/form-data; boundary=&boundary";
|
|
||||||
%if &mdebug=1 %then %do;
|
%if &mdebug=1 %then %do;
|
||||||
debug level=1;
|
debug level=1;
|
||||||
%end;
|
%end;
|
||||||
@@ -73,7 +82,7 @@ run;
|
|||||||
|
|
||||||
%let statcd=0;
|
%let statcd=0;
|
||||||
data _null_;
|
data _null_;
|
||||||
infile &fname1;
|
infile &fname2;
|
||||||
input;
|
input;
|
||||||
putlog _infile_;
|
putlog _infile_;
|
||||||
if _infile_='{"status":"success"}' then call symputx('statcd',1,'l');
|
if _infile_='{"status":"success"}' then call symputx('statcd',1,'l');
|
||||||
|
|||||||
35
server/ms_deletefile.sas
Normal file
35
server/ms_deletefile.sas
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
/**
|
||||||
|
@file
|
||||||
|
@brief Deletes a file from SASjs Drive
|
||||||
|
@details Deletes a file from SASjs Drive, if it exists.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
filename stpcode temp;
|
||||||
|
data _null_;
|
||||||
|
file stpcode;
|
||||||
|
put '%put hello world;';
|
||||||
|
run;
|
||||||
|
%ms_createfile(/some/stored/program.sas, inref=stpcode)
|
||||||
|
|
||||||
|
%ms_deletefile(/some/stored/program.sas)
|
||||||
|
|
||||||
|
@param [in] driveloc The full path to the file in SASjs Drive
|
||||||
|
@param [in] mdebug= (0) Set to 1 to enable DEBUG messages
|
||||||
|
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
%macro ms_deletefile(driveloc
|
||||||
|
,mdebug=0
|
||||||
|
);
|
||||||
|
|
||||||
|
proc http method='DELETE'
|
||||||
|
url="&_sasjs_apiserverurl/SASjsApi/drive/file?_filePath=&driveloc";
|
||||||
|
%if &mdebug=1 %then %do;
|
||||||
|
debug level=2;
|
||||||
|
%end;
|
||||||
|
run;
|
||||||
|
|
||||||
|
|
||||||
|
%mend ms_deletefile;
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
filename &outref temp;
|
filename &outref temp;
|
||||||
|
|
||||||
proc http method='GET' out=&outref
|
proc http method='GET' out=&outref
|
||||||
url="&_sasjs_apiserverurl/SASjsApi/drive/file?filePath=&driveloc";
|
url="&_sasjs_apiserverurl/SASjsApi/drive/file?_filePath=&driveloc";
|
||||||
%if &mdebug=1 %then %do;
|
%if &mdebug=1 %then %do;
|
||||||
debug level=2;
|
debug level=2;
|
||||||
%end;
|
%end;
|
||||||
|
|||||||
@@ -82,3 +82,12 @@ run;
|
|||||||
desc=Test 1 - audit table updated,
|
desc=Test 1 - audit table updated,
|
||||||
outds=work.test_results
|
outds=work.test_results
|
||||||
)
|
)
|
||||||
|
data work.difftest;
|
||||||
|
set perm.audit;
|
||||||
|
where is_diff=1;
|
||||||
|
run;
|
||||||
|
%mp_assert(
|
||||||
|
iftrue=(%mf_nobs(work.difftest)>0),
|
||||||
|
desc=Test 1 - diffs were found,
|
||||||
|
outds=work.test_results
|
||||||
|
)
|
||||||
|
|||||||
61
tests/serveronly/ms_deletefile.test.sas
Normal file
61
tests/serveronly/ms_deletefile.test.sas
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
/**
|
||||||
|
@file
|
||||||
|
@brief Testing ms_deletefile.sas macro
|
||||||
|
|
||||||
|
<h4> SAS Macros </h4>
|
||||||
|
@li ms_createfile.sas
|
||||||
|
@li ms_deletefile.sas
|
||||||
|
@li ms_getfile.sas
|
||||||
|
@li mp_assert.sas
|
||||||
|
@li mp_assertscope.sas
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
|
||||||
|
/* first make a remote file */
|
||||||
|
filename stpcode temp;
|
||||||
|
%let fname=%mf_getuniquename();
|
||||||
|
data _null_;
|
||||||
|
file stpcode;
|
||||||
|
put "data &fname;run;";
|
||||||
|
run;
|
||||||
|
%ms_createfile(/sasjs/tests/&fname..sas
|
||||||
|
,inref=stpcode
|
||||||
|
,mdebug=1
|
||||||
|
)
|
||||||
|
|
||||||
|
%ms_getfile(/sasjs/tests/&fname..sas,outref=testref)
|
||||||
|
|
||||||
|
%let test1=0;
|
||||||
|
data _null_;
|
||||||
|
infile testref;
|
||||||
|
input;
|
||||||
|
call symputx('test1',_infile_);
|
||||||
|
run;
|
||||||
|
|
||||||
|
%mp_assert(
|
||||||
|
iftrue=("&test1"="data &fname;run;"),
|
||||||
|
desc=Make sure the file was created,
|
||||||
|
outds=work.test_results
|
||||||
|
)
|
||||||
|
|
||||||
|
%mp_assertscope(SNAPSHOT)
|
||||||
|
%ms_deletefile(/sasjs/tests/&fname..sas,mdebug=1)
|
||||||
|
%mp_assertscope(COMPARE)
|
||||||
|
|
||||||
|
%ms_getfile(/sasjs/tests/&fname..sas,outref=testref2)
|
||||||
|
|
||||||
|
%let test2=0;
|
||||||
|
data _null_;
|
||||||
|
infile testref2;
|
||||||
|
input;
|
||||||
|
call symputx('test2',_infile_);
|
||||||
|
run;
|
||||||
|
|
||||||
|
%mp_assert(
|
||||||
|
iftrue=("&test2"="%str(Err)or: File does not exist."),
|
||||||
|
desc=Make sure the file was deleted,
|
||||||
|
outds=work.test_results
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
<h4> SAS Macros </h4>
|
<h4> SAS Macros </h4>
|
||||||
@li mp_abort.sas
|
@li mp_abort.sas
|
||||||
|
@li mf_existds.sas
|
||||||
@li mf_getplatform.sas
|
@li mf_getplatform.sas
|
||||||
@li mf_getuniquefileref.sas
|
@li mf_getuniquefileref.sas
|
||||||
@li mf_getuniquelibref.sas
|
@li mf_getuniquelibref.sas
|
||||||
|
|||||||
Reference in New Issue
Block a user