Macros for SAS Application Developers
https://github.com/sasjs/core
ms_deletefile.test.sas
Go to the documentation of this file.
1 /**
2  @file
3  @brief Testing ms_deletefile.sas macro
4 
5  <h4> SAS Macros </h4>
6  @li ms_createfile.sas
7  @li ms_deletefile.sas
8  @li ms_getfile.sas
9  @li mp_assert.sas
10  @li mp_assertscope.sas
11 
12 **/
13 
14 
15 /* first make a remote file */
16 filename stpcode temp;
17 %let fname=%mf_getuniquename();
18 data _null_;
19  file stpcode;
20  put "data &fname;run;";
21 run;
22 %ms_createfile(/sasjs/tests/&fname..sas
23  ,inref=stpcode
24  ,mdebug=1
25 )
26 
27 %ms_getfile(/sasjs/tests/&fname..sas,outref=testref)
28 
29 %let test1=0;
30 data _null_;
31  infile testref;
32  input;
33  call symputx('test1',_infile_);
34 run;
35 
36 %mp_assert(
37  iftrue=("&test1"="data &fname;run;"),
38  desc=Make sure the file was created,
39  outds=work.test_results
40 )
41 
42 %mp_assertscope(SNAPSHOT)
43 %ms_deletefile(/sasjs/tests/&fname..sas,mdebug=1)
44 %mp_assertscope(COMPARE)
45 
46 %ms_getfile(/sasjs/tests/&fname..sas,outref=testref2)
47 
48 %let test2=0;
49 data _null_;
50  infile testref2;
51  input;
52  call symputx('test2',_infile_);
53 run;
54 
55 %mp_assert(
56  iftrue=("&test2"="File doesn't exist."),
57  desc=Make sure the file was deleted,
58  outds=work.test_results
59 )
60 
61