BookmarkSubscribeRSS Feed
Martin_Bryant
Quartz | Level 8

I know that there is the NOMISSING option to ignore missing values entirely, but I just want to be able to treat nulls in numeric fields as equal to a zero, but not equal to any non-zero value. Is this possible?

5 REPLIES 5
andreas_lds
Jade | Level 19

@Martin_Bryant wrote:

I know that there is the NOMISSING option to ignore missing values entirely, but I just want to be able to treat nulls in numeric fields as equal to a zero, but not equal to any non-zero value. Is this possible?


I don't see an option to tread missing values as zeros. Attaching a format to the variable does not work as expected, same for using the missing-option.

Martin_Bryant
Quartz | Level 8
I would have hoped there there was an option to allow all empty values to be treated as equal. Like isempty() in most languages. Zero == null and (empty string) "" == null.
Tom
Super User Tom
Super User

Nope.  You could make versions of your data that replace missing with zero and then compare those versions.

proc stdize data=A out=A_zero missing=0 reponly;
  var _numeric_;
run;
proc stdize data=B out=B_zero missing=0 reponly;
  var _numeric_;
run;
proc compare data=A_zero compare=B_zero ;
run;
Martin_Bryant
Quartz | Level 8
Thanks, I'll have to learn exactly how that works, but sounds a possibility.
Martin_Bryant
Quartz | Level 8
Whilst this is a good work around, I need something that I can use on multiple projects and I was hoping for minimal effort. (I'm a lazy sod.) Anyway, thanks. 🙂

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 2459 views
  • 3 likes
  • 3 in conversation