我想在proc sql中使用where
语句来选择在x
列中找到的已分配给宏变量&grades
的变量。
以下示例不起作用且需要修复:
data work.data;
input x$ y;
datalines;
a 1
a .
b 2
c 3
;
run;
proc sql; select distinct x into :grades separated by ' ' from work.data; quit;
%put &grades; *--- I'M MISSING QUOTES AROUND THE VALUES??;
proc sql; select * from work.data where x in (&grades); quit;
答案 0 :(得分:1)
如果要为值添加引号,请使用quote()
函数。
select distinct quote(x)
into :grades separated by ' '
from work.data
;