bitemporal_dataloader.test.3.sas
Go to the documentation of this file.
1 /**
2  @file
3  @brief Test Harness for bitemporal dataloader
4  @details testing special numerics
5 
6  <h4> SAS Macros </h4>
7  @li bitemporal_dataloader.sas
8  @li mp_assert.sas
9  @li mf_nobs.sas
10 
11  @version 9.2
12  @author 4GL Apps Ltd
13  @copyright 4GL Apps Ltd. This code may only be used within Data Controller
14  and may not be re-distributed or re-sold without the express permission of
15  4GL Apps Ltd.
16 **/
17 
18 
19 %let syscc=0;
20 %let now=%sysfunc(datetime());
21 %let high_date='31DEC8888:23:59:59'dt;
22 
23 /* create base table */
24 data basetable;
25  PK='PK1';field1='somevalue';numvar=.; output;
26  PK='PK2';field1='newvalue';numvar=0; output;
27  PK='PK3';field1='somevalue';numvar=._; output;
28  PK='PK4';field1='newvalue';numvar=.z; output;
29 run;
30 
31 data appendtable;
32  set basetable;
33  if numvar=._ then numvar=.a;
34  if numvar=.z then numvar=.y;
35 run;
36 libname work2(work);
37 
38 proc sql;
39 create table work.mpe_dataloads(
40  libref varchar(8) ,
41  dsn varchar(32) ,
42  etlsource varchar(100) ,
43  loadtype varchar(20) ,
44  changed_records int,
45  new_records int,
46  deleted_records int,
47  duration num,
48  user_nm varchar(50) ,
49  processed_dttm num format=datetime19.3,
50  mac_ver varchar(5)
51 );quit;
52 proc datasets lib=work noprint;
53  modify mpe_dataloads;
54  index create
55  pk_mpe_dataloads=(processed_dttm libref dsn etlsource)
56  /nomiss unique;
57 quit;
58 
59 %bitemporal_dataloader(dclib=work2
60  ,PK=pk
61  ,ETLSOURCE=&_program
62  ,base_dsn=BASETABLE
63  ,LOG=1
64  ,outds_mod=work.changes
65  ,loadtype=UPDATE
66 )
67 
68 %mp_assert(iftrue=(&syscc=0),
69  desc=Testing long ETLSOURCE value
70 )
71 
72 %mp_assert(iftrue=(%mf_nobs(work.changes)=2),
73  desc=Testing special missings
74 )
75 
76