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

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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
  • 981 views
  • 0 likes
  • 2 in conversation