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.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 79847 views
  • 2 likes
  • 2 in conversation