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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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
  • 680 views
  • 0 likes
  • 3 in conversation