I was surprised to find out that the IN operator is not supported variable names.
If things change, just let me know
data demo;
x=1;
run;
data demo1;
set demo;
if x in (1,2) then flag=1;
run;
data demo2;
set demo;
y=1;
if x = y or x =2 then flag=1;
run;
data demo3;
set demo;
y=1;
if x in (y,2) then flag=1;
run;
ERROR 22-322: Syntax error, expecting one of the following: a quoted string, a numeric constant, a datetime constant,
a missing value, iterator, (.
ERROR 202-322: The option or parameter is not recognized and will be ignored.
sasinnovate.png
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just 495ドル!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.