BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Tpham
Quartz | Level 8

So this might be a simple and basic question, but I can't find an answer from searching online

if Var1 in (1 2 3) then var2=1;

so in the code above the IN is include. But is there one that is "not include"?  Typically I would not use this on a if statement, but more of a where statement when running a proc freq for example. I know I can do Var1 NE 0 AND VAR1 NE 4 for example, but wondering if there is a way to list it like I did above

1 ACCEPTED SOLUTION

Accepted Solutions
Amir
PROC Star

Hi,

Have you tried:

data _null_;

  var1=5;

  if var1 not in (1 2 3) then var2=1;

  put var2=;

run;

Regards,

Amir.

View solution in original post

1 REPLY 1
Amir
PROC Star

Hi,

Have you tried:

data _null_;

  var1=5;

  if var1 not in (1 2 3) then var2=1;

  put var2=;

run;

Regards,

Amir.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 3008 views
  • 0 likes
  • 2 in conversation