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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 734 views
  • 0 likes
  • 2 in conversation