Macros for SAS Application Developers
https://github.com/sasjs/core
mp_hashdataset.test.sas
Go to the documentation of this file.
1 /**
2  @file
3  @brief Testing mp_hashdataset.sas macro
4 
5  <h4> SAS Macros </h4>
6  @li mf_nobs.sas
7  @li mp_hashdataset.sas
8  @li mp_assert.sas
9  @li mp_assertscope.sas
10 
11 **/
12 
13 /* test 1 - regular DS */
14 data work.test;
15  set sashelp.vextfl;
16  missval=.;
17  misscval='';
18 run;
19 
20 %mp_assertscope(SNAPSHOT)
21 %mp_hashdataset(test)
22 %mp_assertscope(COMPARE)
23 
24 %mp_assert(
25  iftrue=(&syscc=0),
26  desc=Regular test works,
27  outds=work.test_results
28 )
29 
30 %mp_hashdataset(test,outds=work.test2)
31 
32 %mp_assert(
33  iftrue=(&syscc=0),
34  desc=hash with output runs without errors,
35  outds=work.test_results
36 )
37 
38 %mp_assert(
39  iftrue=(%mf_nobs(work.test2)=1),
40  desc=output has 1 row,
41  outds=work.test_results
42 )
43 
44 
45 data work.test3a;
46  set work.test;
47  stop;
48 run;
49 %mp_hashdataset(test3a,outds=work.test3b)
50 
51 %mp_assert(
52  iftrue=(&syscc=0),
53  desc=hash with zero-row input runs without errors,
54  outds=work.test_results
55 )
56 
57 %mp_assert(
58  iftrue=(%mf_nobs(work.test3b)=1),
59  desc=test 3 output has 1 row,
60  outds=work.test_results
61 )