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

Hello All,

I was trying to create an output for the dataset

ID Date     Plan

1 jan2013   a

1 feb2013   a

1 mar2013   a

1 may2013   b

1 jun2013    b

1 jul2013     a

1 aug2013    a 

 

the output i'm looking to get is  ID    Plan     Date_range

                                              1      a          1-3

                                              2      b          5-6

                                              3       a          7-8

Thanks. Looking forward to some responses.

1 ACCEPTED SOLUTION

Accepted Solutions
data_null__
Jade | Level 19

You can format the min and max into date range yourself right?

data date;
   input ID Date:monyy.  Plan :$1.;
  
format date monyy.;
  
cards;
1 jan2013   a
1 feb2013   a
1 mar2013   a
1 may2013   b
1 jun2013   b
1 jul2013   a
1 aug2013   a
;;;;
   run;
proc print;
  
run;
proc summary data=date nway;
  
by id plan notsorted;
  
format date mmyy.;
  
output out=range min(date)=min max(date)=max;
  
run;
proc print;
  
run;

2-19-2015 4-50-14 PM.png

View solution in original post

2 REPLIES 2
data_null__
Jade | Level 19

You can format the min and max into date range yourself right?

data date;
   input ID Date:monyy.  Plan :$1.;
  
format date monyy.;
  
cards;
1 jan2013   a
1 feb2013   a
1 mar2013   a
1 may2013   b
1 jun2013   b
1 jul2013   a
1 aug2013   a
;;;;
   run;
proc print;
  
run;
proc summary data=date nway;
  
by id plan notsorted;
  
format date mmyy.;
  
output out=range min(date)=min max(date)=max;
  
run;
proc print;
  
run;

2-19-2015 4-50-14 PM.png
SASTad
Fluorite | Level 6

Thank you so much for the help.

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