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-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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