Loading...
Searching...
No Matches
getcolvals.test.1.sas
Go to the documentation of this file.
1/**
2 @file
3 @brief testing getcolvals service
4
5 <h4> SAS Macros </h4>
6 @li mp_assertcolvals.sas
7 @li mp_assertdsobs.sas
8 @li mx_execute.sas
9 @li mf_getuniquefileref.sas
10
11**/
12
13%let _program=&appLoc/services/public/getcolvals;
14
15%let f3=%mf_getuniquefileref();
16data _null_;
17 file &f3 termstr=crlf;
18 put 'LIBDS:$43. COL:$32.';
19 put "&dclib..MPE_X_TEST,SOME_TIME";
20run;
21%mx_execute(&_program,
22 viyacontext=&defaultcontext,
23 inputfiles=&f3:iwant,
24 outlib=web3
25)
26
27data work.vals;
28 set web3.vals;
29 putlog (_all_)(=);
30run;
31data work.check;
32 val=1;output;
33 val=2;output;
34run;
35%mp_assertcolvals(work.vals.unformatted,
36 checkvals=work.check.val,
37 desc=DCLIB found in unfiltered getgolvals response,
38 test=ANYVAL
39)
40
41/**
42 * derived variable
43 */
44
45proc sql;
46delete from &dc_libref..mpe_derived
47 where upcase(libref)="%scan(&dclib..MPE_X_TEST,1,.)"
48 and upcase(dsn)="%scan(&dclib..MPE_X_TEST,2,.)";
49insert into &dc_libref..mpe_derived set
50 tx_from=0
51 ,tx_to='31DEC5999:23:59:59'dt
52 ,libref="%scan(&dclib..MPE_X_TEST,1,.)"
53 ,dsn="%scan(&dclib..MPE_X_TEST,2,.)"
54 ,var_nm='DERIVED_KEY'
55 ,var_deps='PRIMARY_KEY_FIELD'
56 ,var_type='C'
57 ,var_len=20
58 ,var_fmt=''
59 ,var_logic='cats(primary_key_field)'
60 ,active=1;
61quit;
62
63%let f4=%mf_getuniquefileref();
64data _null_;
65 file &f4 termstr=crlf;
66 put 'LIBDS:$43. COL:$32.';
67 put "&dclib..MPE_X_TEST,DERIVED_KEY";
68run;
69%mx_execute(&_program,
70 viyacontext=&defaultcontext,
71 inputfiles=&f4:iwant,
72 outlib=web4
73)
74
75data work.vals4;
76 set web4.vals;
77 putlog (_all_)(=);
78run;
79%mp_assertdsobs(work.vals4,
80 desc=Values are returned for a derived column,
81 test=HASOBS
82)
83
84/* tidy up the config so repeated runs start clean */
85proc sql;
86delete from &dc_libref..mpe_derived
87 where var_nm='DERIVED_KEY'
88 and upcase(libref)="%scan(&dclib..MPE_X_TEST,1,.)"
89 and upcase(dsn)="%scan(&dclib..MPE_X_TEST,2,.)";
90quit;