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

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

1 ACCEPTED SOLUTION

Accepted Solutions
stat_sas
Ammonite | Level 13

proc sql;

select * from have

where abs(date1-date2)>1;

quit;

View solution in original post

2 REPLIES 2
stat_sas
Ammonite | Level 13

proc sql;

select * from have

where abs(date1-date2)>1;

quit;

Haikuo
Onyx | Level 15

Use Range() function could be another option.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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