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