-
Notifications
You must be signed in to change notification settings - Fork 8
/
blankfind.sas
70 lines (48 loc) · 2.15 KB
/
blankfind.sas
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
%macro BlankFind(varlist) / des="Write code to find blank arguments";
/********************************************************************************
BEGIN MACRO HEADER
********************************************************************************
Name: BlankFind
Author: Chris Swenson
Created: 2010-08-19
Purpose: Generate code the find blank macro program arguments. This can be
used to generate "argument checks" at the beginning of a macro
program to ensure that all arguments are populated. The code
cannot be used to do the check because it is best to avoid nested
macros.
Arguments: varlist - the list of macro arguments to generate checks for,
separated by a space
Revisions
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Date Author Comments
¯¯¯¯¯¯¯¯¯¯ ¯¯¯¯¯¯ ¯¯¯¯¯¯¯¯
YYYY-MM-DD III Please use this format and insert new entries above
********************************************************************************
END MACRO HEADER
********************************************************************************/
%if "&VARLIST"="" %then %do;
%put %str(E)RROR: No variable list specified.;
%return;
%end;
%local num i var;
%let num=%sysfunc(countw(&VARLIST));
%put ;
filename _cb_ clipbrd;
data _null_;
format temp1 temp2 $250.;
file _cb_;
%do i=1 %to #
%let var=%upcase(%scan(&VARLIST, &I, %str( )));
temp1='%if %superq(' || "&VAR" || ')=%str() %then %do;';
temp2='%put %str(E)RROR: No argument specified for ' || "&VAR" || '.;';
put temp1;
put ' ' temp2;
put " %return;";
put "%end;";
%end;
run;
filename _cb_ clear;
%put ;
%put NOTE: The generated code has been copied to the clipboard.;
%put NOTE- Paste the code in the appropriate area.;
%mend BlankFind;