bitemporal_dataloader.test.1.sas
Go to the documentation of this file.
1 /**
2  @file
3  @brief Test Harness for bitemporal dataloader
4  @details see below for usage:
5 
6  options mprint;
7  options insert=(sasautos="/pub/programs/macrocore/base");
8  options insert=(sasautos="/pub/programs/macrocore/meta");
9  options insert=(sasautos="/pub/programs/datacontroller/macros");
10 
11  %mpeinit()
12 
13  %bitemporal_tester(test=1)
14 
15  TODO - add short numerics!!!
16 
17 
18  <h4> SAS Macros </h4>
19  @li bitemporal_dataloader.sas
20  @li mp_assert.sas
21 
22  @version 9.2
23  @author 4GL Apps Ltd
24  @copyright 4GL Apps Ltd. This code may only be used within Data Controller
25  and may not be re-distributed or re-sold without the express permission of
26  4GL Apps Ltd.
27 **/
28 
29 
30 %let syscc=0;
31 %let now=%sysfunc(datetime());
32 %let high_date='31DEC8888:23:59:59'dt;
33 
34 /* create base table */
35 data basetable;
36  tx_from_dttm=0;tx_to_dttm=&high_date; PK='PK1';
37  eff_from_dttm=0; eff_to_dttm=&now-10000; field1='somevalue';
38  field2='someothervalue'; output;
39  eff_from_dttm=&now-10000; eff_to_dttm=&high_date; PK='PK1'; field1='newvalue';
40  field2='somenewvalue'; output;
41 run;
42 
43 data appendtable;
44  if 0 then set basetable;
45  eff_from_dttm=&now-500; eff_to_dttm=&now+500; pk='PK1'; field1='blah';
46  field2='blah';output;
47  call symputx('x',repeat('x',200));
48 run;
49 libname work2(work);
50 
51 /* create mpe_dataloads table */
52 proc sql;
53 create table work.mpe_dataloads(
54  libref varchar(8) ,
55  dsn varchar(32) ,
56  etlsource varchar(100) ,
57  loadtype varchar(20) ,
58  changed_records int,
59  new_records int,
60  deleted_records int,
61  duration num,
62  user_nm varchar(50) ,
63  processed_dttm num format=datetime19.3,
64  mac_ver varchar(5)
65 );quit;
66 proc datasets lib=work noprint;
67  modify mpe_dataloads;
68  index create
69  pk_mpe_dataloads=(processed_dttm libref dsn etlsource)
70  /nomiss unique;
71 quit;
72 
73 %bitemporal_dataloader(dclib=work2
74  ,processed=
75  ,PK=pk
76  ,ETLSOURCE=&x
77  ,base_dsn=BASETABLE
78  ,bus_from=eff_from_dttm, bus_to=eff_to_dttm
79  ,tech_from=tx_from_dttm, tech_to=tx_to_dttm
80  ,LOG=1
81 )
82 
83 %mp_assert(iftrue=(&syscc=0),
84  desc=Testing long ETLSOURCE value
85 )
86 
87