That does not have anything to do with numeric vs character variables as the "0" variable should have the number of choices, so it should always look like a number. If you included the %SYMEXIST() function test then perhaps there is an old "0" macro variable hanging around that does not contain a number? Now if you want to treat the values of the macro variables as characters rather than numbers then perhaps you want an %CHARGEN() macro to go with the %NUMGEN() macro so that the returned list is a quoted list of values that you could use in your where clause? Perhaps something like: WHERE AGE IN ("OLD" "YOUNG") %macro numgen(parm); %local i ; %if %bquote(&parm)= %then %put ERROR: &sysmacroname - YOU MUST SPECIFY A VALUE FOR PARM ; %else %if not %symexist(&parm.0) %then &&&PARM ; %else %if %datatyp(&&&parm.0) ne NUMERIC %then %put ERROR: &sysmacroname - Non numeric count - &&&parm.0 ; %else %do i=1 %to &&&parm.0; &&&parm&i %end; %mend numgen; %macro chargen(parm); %local i ; %if %bquote(&parm)= %then %put ERROR: &sysmacroname - YOU MUST SPECIFY A VALUE FOR PARM ; %else %if not %symexist(&parm.0) %then %sysfunc(quote(%qsysfunc(dequote(&&&PARM)))) ; %else %if %datatyp(&&&parm.0) ne NUMERIC %then %put ERROR: &sysmacroname - Non numeric count - &&&parm.0 ; %else %do i=1 %to &&&parm.0; %sysfunc(quote(%qsysfunc(dequote(&&&PARM&i)))) %end; %mend chargen; %let age0=2; %let age=45; %let age1=45; %let age2=50; %put %numgen(age); 45 50 %put %chargen(age); "45" "50"
... View more