Macros for SAS Application Developers
https://github.com/sasjs/core
Loading...
Searching...
No Matches
ms_triggerstp.test.sas
Go to the documentation of this file.
1/**
2 @file
3 @brief Testing ms_triggerstp.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_triggerstp.sas
11 @li mf_existds.sas
12 @li mp_assertdsobs.sas
13 @li mp_assertcols.sas
14 @li mf_getvartype.sas
15 @li ms_deletefile.sas
16
17**/
18
19/* first, create multiple STPs to run */
20filename stpcode1 temp;
21data _null_;
22 file stpcode1;
23 put '%put hello world;';
24 put '%put _all_;';
25 put 'data _null_; file _webout1; put "triggerstp test 1";run;';
26run;
27filename stpcode2 temp;
28data _null_;
29 file stpcode2;
30 put '%put Lorem Ipsum;';
31 put '%put _all_;';
32 put 'data _null_; file _webout2; put "triggerstp test 2";run;';
33run;
34options mprint;
35%let fname1=%mf_getuniquename();
36%let fname2=%mf_getuniquename();
37
38%ms_createfile(/sasjs/tests/&fname1..sas
39 ,inref=stpcode1
40 ,mdebug=1
41)
42%ms_createfile(/sasjs/tests/&fname2..sas
43 ,inref=stpcode2
44)
45
46%mp_assertscope(SNAPSHOT)
47 %ms_triggerstp(/sasjs/tests/&fname1
48 ,debug=131
49 ,outds=work.mySessions
50 )
51 %ms_triggerstp(/sasjs/tests/&fname2
52 ,outds=work.mySessions
53 )
54%mp_assertscope(COMPARE
55 ,ignorelist=MCLIB0_JADP1LEN MCLIB0_JADPNUM MCLIB0_JADVLEN)
56
57%mp_assert(iftrue=%str(%mf_existds(work.mySessions)=1)
58 ,desc=Testing output exists
59 ,outds=work.test_results
60)
61
62%mp_assertdsobs(work.mySessions,
63 test=EQUALS 2,
64 desc=Testing observations,
65 outds=work.test_results
66)
67%mp_assertcols(work.mySessions,
68 cols=sessionid,
69 test=ALL,
70 desc=Testing column exists,
71 outds=work.test_results
72)
73
74data _null_;
75 retain contentCheck 1;
76 set work.mySessions end=last;
77 if missing(sessionID) then contentCheck = 0;
78 if last then do;
79 call symputx("contentCheck",contentCheck,"l");
80 end;
81run;
82%let typeCheck = %mf_getvartype(work.mySessions,sessionid);
83
84%mp_assert(iftrue=%str(&typeCheck = C and &contentCheck = 1)
85 ,desc=Testing type and content of output
86 ,outds=work.test_results
87)
88
89%ms_deletefile(/sasjs/tests/&fname1..sas)
90%ms_deletefile(/sasjs/tests/&fname2..sas)