Loading...
Searching...
No Matches
mpe_getversions.test.sas
Go to the documentation of this file.
1/**
2 @file
3 @brief Testing mpe_getversions macro
4 @details Checking functionality of mpe_getversions.sas macro
5
6 <h4> SAS Macros </h4>
7 @li mf_getuniquefileref.sas
8 @li mf_nobs.sas
9 @li mp_assert.sas
10 @li mp_assertscope.sas
11 @li mpe_getversions.sas
12 @li mx_execute.sas
13
14**/
15
16/* run the macro*/
17%mp_assertscope(SNAPSHOT)
18%mpe_getversions(&mpelib,&mpelib,MPE_DATADICTIONARY, outds=ds0)
19%mp_assertscope(COMPARE,
20 desc=Checking macro variables against previous snapshot
21)
22
23
24/* now stage some data */
25
26%let f1=%mf_getuniquefileref();
27data _null_;
28 file &f1 termstr=crlf;
29 put 'ACTION:$char4. MESSAGE:$char40. LIBDS:$char38.';
30 put "LOAD,staging some data,&dclib..MPE_DATADICTIONARY";
31run;
32data work.jsdata;
33 set &mpelib..MPE_DATADICTIONARY;
34 _____DELETE__THIS__RECORD_____='No';
35 dd_source=cats(ranuni(0));
36 output;
37 stop;
38run;
39%mx_execute(&appLoc/services/editors/stagedata,
40 viyacontext=&defaultcontext,
41 inputfiles=&f1:sascontroltable,
42 inputdatasets=jsdata,
43 outlib=web1,
44 mdebug=&sasjs_mdebug
45)
46
47%let status=0;
48data work.sasparams;
49 set web1.sasparams;
50 putlog (_all_)(=);
51 if status='SUCCESS' then call symputx('status',1);
52 call symputx('dsid',dsid);
53run;
54%mp_assert(
55 iftrue=(&status=1),
56 desc=Checking staged data component,
57 outds=work.test_results
58)
59
60/* now approve the data so the change is applied */
61data work.sascontroltable;
62 ACTION='APPROVE_TABLE';
63 TABLE="&dsid";
64 DIFFTIME="%sysfunc(datetime(),datetime19.)";
65 output;
66 stop;
67run;
68%mx_execute(&appLoc/services/auditors/postdata,
69 viyacontext=&defaultcontext,
70 inputdatasets=work.sascontroltable,
71 outlib=web2,
72 outref=wbout,
73 mdebug=&sasjs_mdebug
74)
75
76
77/* finally - check that we have an extra version! */
78
79%mpe_getversions(&mpelib,&mpelib,MPE_DATADICTIONARY, outds=ds1)
80
81%mp_assert(
82 iftrue=(%mf_nobs(ds0) = %mf_nobs(ds1)-1),
83 desc=Checking one extra version was created
84)
85