BookmarkSubscribeRSS Feed

How do I rename "real_date" to "year_qtr" to show in the proc summary output?

 

data for_summary;
set OUTPAT;
real_date=input(eventdate,YYMMDD10.);
format real_date date9.;
run;

proc summary data=for_summary;
where (cpt between '99201' and '99215')
or (cpt between '99241' and '99245')
or (cpt between '99381' and '99397')
or (cpt between '99354' and '99355')
or (cpt between '99401' and '99412')
;
where also real_date between '01JAN2021'd and '30JUN2021'd;
class real_date;
format real_date yyq6.;
var cost;
output out=EMpull2 sum=QTR_COST;
run;

3 REPLIES 3
Norman21
Lapis Lazuli | Level 10

In the penultimate line of your code, try:

 

output out= EMpull2 (rename=(sum=QTR_COST real_date=year_qtr) ) ;
Norman.
SAS 9.4 (TS1M6) X64_10PRO WIN 10.0.17763 Workstation

That worked. Now, I'm trying to have an output that shows the distinct count of an ID called "memberno" by quarter.  So I would like to see how many distinct members there were in Q1 vs. Q2 along with the cpt codes and cost.  So it would look like this:

 

cpt codes  Q1                                            Q2                                                     cost

code1       #ofmmbers with this code         #of members with this code in         $$$$

code2        #of members with this code

....

 

proc summary data=for_summary;
where (cpt between '99201' and '99215')
or (cpt between '99241' and '99245')
or (cpt between '99381' and '99397')
or (cpt between '99354' and '99355')
or (cpt between '99401' and '99412')
;
where also real_date between '01JAN2021'd and '30JUN2021'd;
class cpt real_date;
format real_date yyq6.;
var cost;
output out=EMpull2 (rename=(sum=QTR_COST real_date=year_qtr) ) ;
run;

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 3 replies
  • 4012 views
  • 0 likes
  • 3 in conversation