Macros for SAS Application Developers
https://github.com/sasjs/core
mp_makedata.test.sas
Go to the documentation of this file.
1 /**
2  @file
3  @brief Testing mp_makedata.sas macro
4 
5  <h4> SAS Macros </h4>
6  @li mf_nobs.sas
7  @li mp_makedata.sas
8  @li mp_assert.sas
9 
10 **/
11 
12 /**
13  * Test 1 - Regular makedata call
14  */
15 
16 proc sql;
17 create table work.example(
18  TX_FROM float format=datetime19.,
19  DD_TYPE char(16),
20  DD_SOURCE char(2048),
21  DD_SHORTDESC char(256),
22  constraint pk primary key(tx_from, dd_type,dd_source),
23  constraint nnn not null(DD_SHORTDESC)
24 );
25 %mp_makedata(work.example,obs=500)
26 
27 %mp_assert(
28  iftrue=("%mf_nobs(work.example)"="500"),
29  desc=Check that 500 rows were created,
30  outds=work.test_results
31 )
32 
33 data _null_;
34  set work.example;
35  call symputx('lenvar',length(dd_source));
36  stop;
37 run;
38 %mp_assert(
39  iftrue=("&lenvar"="2048"),
40  desc=Check that entire length of variable is populated,
41  outds=work.test_results
42 )
43 
44 
45 proc sql;
46 create table work.example2(
47  TX_FROM float format=datetime19.,
48  DD_TYPE char(16),
49  DD_SOURCE char(2048),
50  DD_SHORTDESC char(256),
51  some_num num
52 );
53 %mp_makedata(work.example2)
54 
55 %mp_assert(
56  iftrue=(&syscc=0),
57  desc=Ensure tables without keys still generate,
58  outds=work.test_results
59 )