SAS Enterprise Guide

Desktop productivity for business analysts and programmers
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-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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