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?
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!
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.