例如,我有:
%let state_exclude = Michigan Maine Minnesota;proq sql; create table States select state from geography_dim as geo where geo.country="US" and geo.state ~= "&state_exclude"quit;
%let state_exclude = Michigan Maine Minnesota;
proq sql;
create table States
select state
from geography_dim as geo
where geo.country="US" and geo.state ~= "&state_exclude"
quit;
它返回零行,我想这是因为我在那里如何使用宏变量,但我不知道如何修复它
sr4lhrrt1#
我不是美国人,是“密歇根州缅因州明尼苏达州”三个独立的地方吗?如果是这样,你应该使用 in 操作员而不是 = . 例如:
in
=
%let state_exclude = "Michigan" "Maine" "Minnesota"; proq sql; create table States as select state from geography_dim where country="US" and state not in (&state_exclude);quit;
%let state_exclude = "Michigan" "Maine" "Minnesota";
create table States as
select state from geography_dim
where country="US" and state not in (&state_exclude);
1条答案
按热度按时间sr4lhrrt1#
我不是美国人,是“密歇根州缅因州明尼苏达州”三个独立的地方吗?如果是这样,你应该使用
in
操作员而不是=
. 例如: