Help using Base SAS procedures

sas query

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 145
Accepted Solution

sas query

Can some one help me onthis.....I have a dataset with three variables ID,DATE1,DATE2..

I should write a query in output those which have difference in dates greater then one.

100010001           2014-08-18          2014-08-18

100010001           2014-08-12          2014-08-12

100010001           2014-09-09          2014-09-02

100010001           2014-09-30          2014-09-23

100010001           2014-10-21          2014-10-14

100010001           2014-11-11          2014-11-04

100010002           2014-09-15          2014-09-15

100010002           2014-09-08          2014-09-08

100010002           2014-10-06          2014-09-29

100010002           2014-10-20          2014-10-29

100010003           2015-03-11          2015-03-11

100010003           2015-03-04          2015-03-04

100010003           2015-04-01          2015-04-25

100010003           2015-04-15          2015-04-20

Thanks in Advance


Accepted Solutions
Solution
‎06-02-2015 02:36 PM
Trusted Advisor
Posts: 1,228

Re: sas query

Posted in reply to rakeshvvv

proc sql;

select * from have

where abs(date1-date2)>1;

quit;

View solution in original post


All Replies
Solution
‎06-02-2015 02:36 PM
Trusted Advisor
Posts: 1,228

Re: sas query

Posted in reply to rakeshvvv

proc sql;

select * from have

where abs(date1-date2)>1;

quit;

Respected Advisor
Posts: 3,156

Re: sas query

Posted in reply to rakeshvvv

Use Range() function could be another option.

🔒 This topic is solved and locked.

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

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