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.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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