Quote macrovariables e.g. for an IN SQL-statement

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.