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

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!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 754 views
  • 0 likes
  • 3 in conversation