BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
_maldini_
Barite | Level 11

What is the proper syntax for including multiple non-sequential variables as arguments in the parentheses after a missing statement?

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

You can NMISS() function if ALL of the variables are character.  Or use the CMISS() function if ANY of the variables are character.

 

If you just want to test if ANY of the variables are missing then do:

 

if nmiss(of var1 var5 var13) then newvar=.;

If you need to test if ALL of the variables are missing and all of them are numeric then you could use the N() function instead.

if N(of var1 var5 var13)=0 then newvar=.;

 

But if any are character then you need to know how many there are.

if cmiss(of var1 var5 var13)=3 then newvar=.;

 

View solution in original post

1 REPLY 1
Tom
Super User Tom
Super User

You can NMISS() function if ALL of the variables are character.  Or use the CMISS() function if ANY of the variables are character.

 

If you just want to test if ANY of the variables are missing then do:

 

if nmiss(of var1 var5 var13) then newvar=.;

If you need to test if ALL of the variables are missing and all of them are numeric then you could use the N() function instead.

if N(of var1 var5 var13)=0 then newvar=.;

 

But if any are character then you need to know how many there are.

if cmiss(of var1 var5 var13)=3 then newvar=.;

 

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!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 400 views
  • 1 like
  • 2 in conversation