SAS Tips from the Community

SAS tips from real SAS users like you
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-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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