I am using a macro in SAS to loop over the data tables in a specific library. I put the metadata information in a data null step and make a comparison with a where statement and my macro variable.
My SQL step looks like:
proc sql;
select quote(trim(code)) into :procedures separated by ', ' from procedures;
quit;
Some values of code
contain values like "45.10" and "G0102", so cannot be coerced to numeric. The macro contains the line:
%macro filter_codes(indata, outdata);
data &outdata;
set &indata(where = (code in (&procedures)));
run;
%mend;
but the decimal values create an issue when double-quoted using the "quote" function.
Can I separate values with single quotes?
EDIT: The issue was caused by the fact that the filter_codes macro was run within a call execute step (over a range of datasets) and double quotes resolved in macro variables inside of double quotes would end the call execute.
Try this:
proc sql;
select catt("'", code, "'") into :procedures separated by ', ' from procedures;
quit;
Also fix the where option in set statement:
set &indata(where=(code in (&procedures)));