Loading...
Searching...
No Matches
mpe_refreshtables.test.sas
Go to the documentation of this file.
1/**
2 @file
3 @brief Testing mpe_refreshtables macro
4
5 <h4> SAS Macros </h4>
6 @li mpe_refreshlibs.sas
7 @li mpe_refreshtables.sas
8 @li mf_getuniquefileref.sas
9 @li mf_mkdir.sas
10 @li mp_assert.sas
11 @li mp_assertscope.sas
12
13 @author 4GL Apps Ltd
14 @copyright 4GL Apps Ltd. This code may only be used within Data Controller
15 and may not be re-distributed or re-sold without the express permission of
16 4GL Apps Ltd.
17
18**/
19
20/* create a new library with a demo format catalog, so it always exists */
21%let reftstloc=%sysfunc(pathname(&dc_libref))/reftst%mf_getuniquefileref();
22%mf_mkdir(&reftstloc)
23libname reftst "&reftstloc";
24
25data work.reftstfmts;
26 length fmtname $32;
27 fmtname='REFFMT';
28 do start=1 to 10;
29 label=cats('Format ',start);
30 output;
31 end;
32run;
33proc format cntlin=work.reftstfmts library=reftst.dcfmts;
34run;
35
36/* register the library in mpe_datacatalog_libs */
37%mpe_refreshlibs(lib=REFTST)
38
39%mp_assertscope(SNAPSHOT)
40%mpe_refreshtables(REFTST)
41%mp_assertscope(COMPARE,
42 desc=Checking macro variables against previous snapshot
43)
44
45/* make sure that the process picks up a library that contains a catalog */
46proc sql;
47create table work.libinfo as
48 select a.engine,
49 a.libname,
50 a.paths,
51 a.perms,
52 a.owners,
53 a.schemas,
54 a.libid,
55 b.libsize,
56 b.table_cnt,
57 b.catalog_cnt
58 from &mpelib..mpe_datacatalog_libs(where=(&dc_dttmtfmt. lt tx_to)) a
59 left join &mpelib..mpe_datastatus_libs(where=(&dc_dttmtfmt. lt tx_to)) b
60 on a.libref=b.libref
61 where a.libref="REFTST";
62
63%let test1=0;
64data _null_;
65 set work.libinfo;
66 call symputx('test1',catalog_cnt);
67run;
68%mp_assert(
69 iftrue=(&test1>0),
70 desc=Checking reftst.dcfmts was picked up
71)