Help using Base SAS procedures

OUTPUT

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 16
Accepted Solution

OUTPUT

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.


Accepted Solutions
Solution
‎02-19-2015 05:51 PM
Respected Advisor
Posts: 3,777

Re: OUTPUT

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


All Replies
Solution
‎02-19-2015 05:51 PM
Respected Advisor
Posts: 3,777

Re: OUTPUT

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
Occasional Contributor
Posts: 16

Re: OUTPUT

Thank you so much for the help.

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

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