Below is code that produces a quoted string from a column in a dataset. This can be used in an IN-statement in SQL.
proc sql; select quote(Compress(name)) into :SQLMetaSrc separated by ',' from datasets ; quit;
Below is code that produces a quoted string from a column in a dataset. This can be used in an IN-statement in SQL.
proc sql; select quote(Compress(name)) into :SQLMetaSrc separated by ',' from datasets ; quit;
The code below lets you qoute the contant of a macrovariables e.g. to be used in an IN SQL-statement.
%let Variables = age height weight; %let InStatement = %Str(%’)%sysfunc(Tranwrd(&Variables.,%Str( ),%Str(%’, %’)))%Str(%’);
The macrovariable InStatement will contain ‘age’,’height’,’weight’. And can then be used in an IN SQL-statement.