-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathassert()
More file actions
25 lines (20 loc) · 801 Bytes
/
assert()
File metadata and controls
25 lines (20 loc) · 801 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
%macro assert(find,in);
%let find = %upcase(&find); %let in = %upcase(&in); %let notfound = Could not find:;
%do i=1 %to %sysfunc(countw(&find,~));
%do j=1 %to %sysfunc(countw(&in,~));
%if %nrquote(%scan(&find,&i,"~")) = %nrquote(%scan(&in,&j,"~")) %then %goto udafloop;
%end;
%let notfound = ¬found %scan(&find,&i,"~") ;
%let founddum = 1;
%udafloop:
%end;
%put Checked %sysfunc(countw(&find,~)) codes against %sysfunc(countw(&in,~)) codes in data.;
%if %symexist(founddum) %then %put ERROR: ¬found;
%if %sysfunc(countw(&find,~)) < %sysfunc(countw(&in,~)) %then %put ERROR: More codes found than specified;
%mend assert;
proc sql noprint;
select distinct type into :indata separated by '~'
from sashelp.cars;
quit;
%let findthese = sedan~suv;
%assert(&findthese,&indata);