BookmarkSubscribeRSS Feed
Kevin_Graduate
Calcite | Level 5
The numeric value for a is 18735.

data work.test;
a='18APR11'D;
b=.;
output;
run;

data work.test2;
set work.test;
if a-b>1825 then c=1;
if a-b<1825 then c=2;
run;

proc print data=work.test2;
run;

Result: c=2.

Why c=2? It makes more sense if it is 1.
2 REPLIES 2
SteveDenham
Jade | Level 19
The value for a-b is ., which is less than any value. I would expect c=2 as the only possible result.

Steve Denham
MichelleHomes
Meteorite | Level 14
Hi Kevin,

If you want missing values to be ignored use SAS functions instead...

e.g.
if sum(a,-b)>1825 then c=1;
if sum(a,-b)<1825 then c=2;

this will then ignore the missing value and you will get your desired c=1 as your result.

This is described in the SAS documentation and in the SAS programming 1 course.

Kind Regards,
Michelle
//Contact me to learn how Metacoda software can help keep your SAS platform secure - https://www.metacoda.com

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 2 replies
  • 1179 views
  • 0 likes
  • 3 in conversation