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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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
  • 323 views
  • 1 like
  • 2 in conversation