Macros for SAS Application Developers
https://github.com/sasjs/core
mp_searchcols.test.sas
Go to the documentation of this file.
1 /**
2  @file
3  @brief Testing mp_searchcols.sas
4 
5  <h4> SAS Macros </h4>
6  @li mp_searchcols.sas
7  @li mp_assertdsobs.sas
8 
9 
10 **/
11 
12 
13 /** Test 1 - full col match */
14 data example1;
15  var1=1;
16  var2=2;
17  var3=3;
18 data example2;
19  var1=1;
20  var2=2;
21 data example3;
22  var2=2;
23  var3=3;
24 data example4;
25  matchmehere=1;
26 data example5;
27  hereyoucan_matchme_also=1;
28 data example6;
29  do_not_forget_me=1;
30 data example7;
31  we_shall_not_forget=1;
32 run;
33 
34 %mp_searchcols(libs=work,cols=var1 var2,outds=testme)
35 
36 %mp_assertdsobs(work.testme,
37  desc=Test1 - check exact variables are found,
38  test=EQUALS 3,
39  outds=work.test_results
40 )
41 
42 /* test 2 - wildcard match */
43 
44 %mp_searchcols(libs=work,cols=matchme forget,match=WILD, outds=testme2)
45 
46 %mp_assertdsobs(work.testme2,
47  desc=Test1 - check fuzzy matches are found,
48  test=EQUALS 4,
49  outds=work.test_results
50 )