Macros for SAS Application Developers
https://github.com/sasjs/core
Loading...
Searching...
No Matches
mf_getattrn.test.sas
Go to the documentation of this file.
1/**
2 @file
3 @brief Testing mf_getattrn macro
4
5 <h4> SAS Macros </h4>
6 @li mf_getattrn.sas
7 @li mp_assert.sas
8 @li mp_assertscope.sas
9
10**/
11
12data work.attrn_test;
13 length charvar $10 numvar 8;
14 do numvar=1 to 4;
15 charvar=cats('row',numvar);
16 output;
17 end;
18run;
19
20%mp_assertscope(SNAPSHOT)
21%put scope check:%mf_getattrn(work.attrn_test,NLOBS);
22%mp_assertscope(COMPARE,
23 desc=Checking that mf_getattrn does not leak scope,
24 outds=work.test_results
25)
26
27%mp_assert(
28 iftrue=(%mf_getattrn(work.attrn_test,NLOBS)=4),
29 desc=Checking NLOBS returns the observation count,
30 outds=work.test_results
31)
32
33%mp_assert(
34 iftrue=(%mf_getattrn(work.attrn_test,NVARS)=2),
35 desc=Checking NVARS returns the variable count,
36 outds=work.test_results
37)
38
39%mp_assert(
40 iftrue=(%mf_getattrn(work.no_such_dataset,NLOBS)=-1),
41 desc=Checking a dataset that cannot be opened returns -1,
42 outds=work.test_results
43)