BookmarkSubscribeRSS Feed
nisha_a
Calcite | Level 5
I have records as follows:

Subject startdt. enddt dur
01 01jan2019 01jan2019 1
01 02jan2019 02jan2019 1
01 03jan2019 03jan2019 1
01 05jan2019 05jan2019 1

I want the records with consecutive dates, that is from 1jan to 3jan be collapsed as 1 record and the dur value should be 3. Also the 5jan record should be left as is Because the date is not a consecutive date.
1 REPLY 1
PaigeMiller
Diamond | Level 26

A couple of questions:

 

  • does subject play any role in the calculations or analysis? If so, how?
  • can start date and end date be different?

If you answer YES to any of these, can you provide a more realistic example of the data?


Also: 
when you say "Because the date is not a consecutive date" what date are you referring to, start date or enddate? 

 

Also: can you please provide working SAS code to read in your example data into a SAS data set?

--
Paige Miller

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

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
  • 1 reply
  • 908 views
  • 0 likes
  • 2 in conversation