sas - single quoting values using sql to create macro variable -


i using macro in sas loop on data tables in specific library. put metadata information in data null step , make comparison statement , macro variable.

my sql step looks like:

proc sql;   select quote(trim(code)) :procedures separated ', ' procedures; quit; 

some values of code contain values "45.10" , "g0102", cannot coerced numeric. macro contains line:

%macro filter_codes(indata, outdata);   data &outdata;      set &indata(where = (code in (&procedures)));   run; %mend; 

but decimal values create issue when double-quoted using "quote" function.

can separate values single quotes?

edit: issue caused fact filter_codes macro run within call execute step (over range of datasets) , double quotes resolved in macro variables inside of double quotes end call execute.

try this:

proc sql;   select catt("'", code, "'") :procedures separated ', ' procedures; quit; 

also fix option in set statement:

set &indata(where=(code in (&procedures))); 

Comments

Popular posts from this blog

java - JavaFX 2 slider labelFormatter not being used -

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -