BookmarkSubscribeRSS Feed
🔒 This topic is locked. We are no longer accepting replies to this topic. Need further help? Please sign in and ask a new question.
SAS_Tipster
Moderator

The IS MISSING and IS NULL operators, which are used with a WHERE statement, can handle character or numeric variables. They also work with the NOT operator:

 

*** create a sample dataset with some missing values;
data makemissing;
    set sashelp.class;
    if substr(name,1,1) eq 'J' then initial='J';
    if 11 le age le 13 then newage=age;
run;
 
*** use missing;
proc print data=makemissing;
    where initial is missing and newage is not missing;
run;
 
*** or equivalently, use IS NULL;
proc print data=makemissing;
    where initial is null and newage is not null;
run;

This may be especially useful in a macro that takes mixed-type variables as parameters in a where clause.

 

Thanks to Mary Rosenbloom for submitting this tip on sasCommunity.org!

1 REPLY 1
RW9
Diamond | Level 26 RW9
Diamond | Level 26

There is also the missing() function which does either data type.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

Visit a random SAS tip This SAS Tips board is not open for replies or comments, but we welcome your feedback and questions. Have a question or comment about this tip? Start a new topic in one of our discussion boards, and reference this tip topic.
Discussion stats
  • 1 reply
  • 79041 views
  • 2 likes
  • 2 in conversation