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;
In the penultimate line of your code, try:
output out= EMpull2 (rename=(sum=QTR_COST real_date=year_qtr) ) ;
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;
Define "output". Do you mean the print output in the Results window/tab, or the resulting dataset?
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.
Ready to level-up your skills? Choose your own adventure.