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 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!

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
  • 80598 views
  • 2 likes
  • 2 in conversation