If you are going to use CALL EXECUTE() to submit macro calls to run after your current data step finishes you should get in the habit of use %NRSTR() function to suppress the execution of the macro during the execution of the CALL EXECUTE() statement. Personally I like to just wrap the macro name itself in the %NRSTR() and leave any parameters unquoted.
data _null_;
set x_dirlist;
if upcase(substr(name,1,5)) = 'FI03H';
call execute(cats('%nrstr(%convert_file)(',name,')'));
run;
Which will result in code like this being stacked up to execute.
%nrstr(%convert_file)(FIO3H_170131.skv)
%nrstr(%convert_file)(FIO3H_170228.skv)
You can also just avoid CALL EXECUTE() and use the data step to write the code to a file and then use %INCLUDE to run. Then there is no need for the %NRSTR() macro functions. This process also has other advantages over CALL EXECUTE() because you can more easily debug the logic of the code generation. Plus use can take advantage of the features of the PUT statement to help in generating code that will make the SAS log clearer. For example if your source dataset has variables with names that match the parameters for the macro you generating the call for you can use the VAR= syntax on the PUT statement write both the parameter name and its value.
For example if you have a macro name like this with three parameters.
%macro printit(dsn=,bylist=,varlist=);
proc print data=&dsn;
by &bylist ;
var &varlist;
run;
%mend printit;
And you had a dataset with the variables DSN, BYLIST and VARLIST then you could generate a series of call using code like this.
filename code temp;
data _null_;
file code;
set print_list;
put '%printit(' dsn= ',' bylist= ',' varlist= ')' ;
run;
%include code / source2 ;
... View more