I have used SCAPROC to list particular variables in my code, but I can't seem to figure out a way to also list my macro arguments from the same code. An example of these arguments would be the report= and subject= in EXAMPLE 1. I can use the code from EXAMPLE 2 to
determine the table names used in the code and save it as a text file but I can't seem to be able to list the macro variables from EXAMPLE 1.
Can anyone point me in a potential direction?
EXAMPLE 1
%macro email_result;
%if &syserr=0 or &syserr=4 %then %do;
%dw_std_email(report="AUTO &report_name",subject="&subject_line",
attach1="&file_path &file_name"
content_type="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
%end;
%mend;
%email_result;
EXAMPLE 2
%macro document_table2;
%if &documentation_flag. = 'YES' %then %do;
proc scaproc;
write;
run;
filename sca_rec "&documentation.\&documentation_name..txt";
data myinfo;
infile sca_rec truncover;
input @1 scaline $256.;
length library_name $20 table_name $25 data_type $5;
keep library_name table_name data_type;
retain prxfile prxidata;
if _n_ = 1 then do;
prxifile = prxparse("!\bJOBSPLIT: FILE INPUT SEQ (\b.*\b) \*/!");
prxidata = prxparse("!\bJOBSPLIT: DATASET INPUT (\b.*\b) \*/!");
end;
if prxmatch (prxidata,scaline) > 0 then do;
if scan(prxposn(prxidata,1,scaline), -1) = 'MULTI' OR
scan(prxposn(prxidata,1,scaline), -1) = 'SEQ' then do;
myinfo = scan(prxposn(prxidata,1,scaline), -1, ' ');
library_name = scan(myinfo,1, '.');
table_name = scan(myinfo,2, '.');
data_type = scan(myinfo,3, '.');
end;
else do;
myinfo = scan(prxposn(prxidata,1,scaline), -1, ' ');
library_name = scan(myinfo,1, '.');
table_name = scan(myinfo,2, '.');
data_type = scan(myinfo,3, '.');
end;
end;
if library_name ne ' ';
run;
proc export data = myinfo
outfile = "&documentation.\&documentation_name..xls"
dbms = xls replace;
run;
%end;
%mend;
%document_table2;
... View more