Loading...
Searching...
No Matches
getstagetable.test.sas
Go to the documentation of this file.
1/**
2 @file
3 @brief testing getstagetable service
4
5 <h4> SAS Macros </h4>
6 @li mx_execute.sas
7 @li mp_assert.sas
8 @li mp_assertdsobs.sas
9
10**/
11
12/**
13 * First part - stage some data (to fetch via getstagetable)
14 */
15data work.sascontroltable;
16 action='LOAD';
17 message="getstagetable prep";
18 libds="&dclib..MPE_X_TEST";
19 output;
20 stop;
21run;
22
23proc sql noprint;
24select max(primary_key_field) into: maxpk
25 from &dclib..mpe_x_test;
26
27data work.jsdata;
28 set &dclib..mpe_x_test;
29 if _n_=1 then do;
30 _____DELETE__THIS__RECORD_____='No';
31 some_char='getstagetable test';
32 some_num=&maxpk+1;
33 output;
34 end;
35 else stop;
36run;
37
38%mx_execute(&appLoc/services/editors/stagedata,
39 viyacontext=&defaultcontext,
40 inputdatasets=work.sascontroltable work.jsdata,
41 outlib=web1,
42 mdebug=&sasjs_mdebug
43)
44
45%let status=0;
46data _null_;
47 set web1.sasparams;
48 putlog (_all_)(=);
49 if status='SUCCESS' then call symputx('status',1);
50 call symputx('dsid',dsid);
51run;
52
53%mp_assert(
54 iftrue=(&status=1 and &syscc=0),
55 desc=Checking successful submission,
56 outds=work.test_results
57)
58
59/**
60 * Now fetch the staged table with getstagetable
61 */
62data work.iwant;
63 table_id="&dsid";
64 output;
65run;
66
67%mx_execute(&appLoc/services/auditors/getstagetable,
68 viyacontext=&defaultcontext,
69 inputdatasets=work.iwant,
70 outlib=web2,
71 mdebug=&sasjs_mdebug
72)
73
74/* the staged table must be returned with our row in it */
75%let stagecheck=0;
76%let fmtcheck=0;
77data _null_;
78 set web2.stagetable;
79 if some_char='getstagetable test' and some_num=&maxpk+1
80 then call symputx('stagecheck',1);
81run;
82data _null_;
83 set web2.fmt_stagetable;
84 if some_char='getstagetable test' then call symputx('fmtcheck',1);
85run;
86
87%mp_assertdsobs(web2.stagetable,
88 desc=getstagetable returns the staged table,
89 test=EQUALS 1,
90 outds=work.test_results
91)
92%mp_assertdsobs(web2.fmt_stagetable,
93 desc=getstagetable returns the formatted staged table,
94 test=EQUALS 1,
95 outds=work.test_results
96)
97%mp_assert(
98 iftrue=(&stagecheck=1 and &fmtcheck=1),
99 desc=Checking staged changes present in both unformatted and formatted outputs,
100 outds=work.test_results
101)