Help using Base SAS procedures

If condition

Accepted Solution Solved
Reply
Super Contributor
Posts: 1,040
Accepted Solution

If condition

Hi,

I am trying to find if date variable is greater than surgery variable by 35days

both are dates.

is this below code right??????

data want;

set have;

if date ge (Surgery - 60*60*24*35);

run;

Thanks


Accepted Solutions
Solution
‎11-13-2013 12:31 PM
Super Contributor
Posts: 339

Re: If condition

That would work if your values were datetime, not date. Date formats are stored as the number of days since a fixed date (01/01/1960) so you'd simply need to substract 35.

It is typically best to get accustomed to the intnx function though for date distance. I'll let you look that up.

View solution in original post


All Replies
Solution
‎11-13-2013 12:31 PM
Super Contributor
Posts: 339

Re: If condition

That would work if your values were datetime, not date. Date formats are stored as the number of days since a fixed date (01/01/1960) so you'd simply need to substract 35.

It is typically best to get accustomed to the intnx function though for date distance. I'll let you look that up.

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 1 reply
  • 132 views
  • 0 likes
  • 2 in conversation