Macros for SAS Application Developers
https://github.com/sasjs/core
ms_runstp.test.sas
Go to the documentation of this file.
1 /**
2  @file
3  @brief Testing ms_runstp.sas macro
4 
5  <h4> SAS Macros </h4>
6  @li mf_getuniquename.sas
7  @li mp_assert.sas
8  @li mp_assertscope.sas
9  @li ms_createfile.sas
10  @li ms_runstp.sas
11 
12 **/
13 
14 /* first, create an STP to run */
15 filename stpcode temp;
16 data _null_;
17  file stpcode;
18  put '%put hello world;';
19  put '%put _all_;';
20  put 'data _null_; file _webout; put "runstptest";run;';
21 run;
22 
23 options mprint;
24 %let fname=%mf_getuniquename();
25 
26 %ms_createfile(/sasjs/tests/&fname..sas
27  ,inref=stpcode
28  ,mdebug=1
29 )
30 
31 %mp_assertscope(SNAPSHOT)
32 %ms_runstp(/sasjs/tests/&fname
33  ,debug=131
34  ,outref=weboot
35 )
36 %mp_assertscope(COMPARE)
37 
38 %let test1=0;
39 %let test2=0;
40 data _null_;
41  infile weboot;
42  input;
43  if _n_=1 then call symputx('test1',_infile_);
44  if _n_=3 then do;
45  call symputx('test2',substr(_infile_,1,30));
46  putlog "SASJS_LOGS_SEPARATOR_xxx"; /* this marker affects the CLI parser */
47  end;
48  else putlog _infile_;
49 run;
50 
51 
52 
53 %mp_assert(
54  iftrue=("&test1"="runstptest"),
55  desc=Checking webout was created,
56  outds=work.test_results
57 )
58 
59 %mp_assert(
60  iftrue=("&test2"="SASJS_LOGS_SEPARATOR_163ee17b6"),
61  desc=Checking debug was enabled,
62  outds=work.test_results
63 )