BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
BETO
Fluorite | Level 6

a HI I have an if statement

data ms;

set ms;

actual = datedif (date,today(), 'act/act');

put actual= ;

gets me number  of days from date to today date...

data ms;

set ms;

select;

when (actual=.) copy= " ";

when (actual <0 or  actual > -15 ) Copy "pre_15";

when ( actual >=1 or actual <=90) copy " post_90";

end;

run;

I Want to Id what's within 15 days an that number is  a negative reason its a -15...

i Want to ID post 90 days I'm using today date to get the datediff and date. Thanks

Message was edited by: gilbert arredondo

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

You need AND not OR In your conditions.

As Chris has indicated you need an equal in your assignment statement for the copy variable.

View solution in original post

5 REPLIES 5
ChrisNZ
Tourmaline | Level 20

1- There is no IF in your code; what with the title?

2- The copy keyword is invalid syntax as used in your code

3- The last sentences make little sense

If you want to be helped the least you can do is present a properly explained and presented case.

BETO
Fluorite | Level 6

it was an if statement I change it before I asked the question....Chris if it doesn't make sense  to you need to respond I try to make it as clear as possible

Reeza
Super User

You need AND not OR In your conditions.

As Chris has indicated you need an equal in your assignment statement for the copy variable.

BETO
Fluorite | Level 6

Thanks Reeza ... I will take your suggestion...It a snippe of code that works for me on other code but it's character not number 

BETO
Fluorite | Level 6

HI reeza 

i Got it

data table;

set table;

if actual ge 0 and actual Le 90 then copy = "post_90";

thanks

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