BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
alawton
Calcite | Level 5

I have written a proc report to reproduce a pre-existing report in another application. In my data, I have two types (Admit and Discharge), for which each of the four calculations must be presented. Three of the four calculations exist in the dataset, while the rate must be calculated within proc report. In order to accomplish this, I have made rate a computed variable and made a formula (numrec/nummeds) to accomplish my task. The first occurence (_c4_ for type=Admit) is rendered correctly, but the second occurence (_c8_ for type=Discharge) receives all missing values.

If I change the computed formula to _c8_=c9_ or _c8_=_c10_, I still receive missing values. It appears that no data exists in columns 9 and 10. However, when I run the original program, I see values in columns 9 and 10 in proc report output. Also, I can make the formula _c8_=1 and it will populate the desired column with the values, albeit meaningless values. How can I correct my formula in the computed block to correctly render the rate in _c8_?

Thank you in advance for your assistance.

- Aaron

MY PROGRAM:

proc report data=med_rec2 nowd;
columns service_line provider_speciality type, (enc rate nummeds numrec );
define service_line / group 'Service Line';
define provider_speciality / group 'Service Line-/ Provider Specialty' style=[indent=20];
define type / across '';
define enc / analysis sum format=comma14. 'Patient/Encounters';
define rate / computed format=percent12.2 'Encounters 100%/Reconciled Within/24 Hrs of/Readmission';
define nummeds / analysis sum format=comma14. 'PTA Meds/Within24 Hrs/of Admission';
define numrec / analysis sum format=comma14. 'Meds #/Reconciled/Within 24 Hrs/of Admission';

break before service_line / summarize skip ol style=[background=skyblue indent=0];
compute before service_line;
provider_speciality=service_line;
endcomp;

rbreak after / summarize style=[font_weight=bold  font_size=12.50pt background=light gray indent=0];
compute after ;
provider_speciality='TOTAL';
endcomp;

compute rate;
_c4_ = _c6_ / _c5_;
_c8_ = _c10_ / _c9_;
endcomp;
run;

1 ACCEPTED SOLUTION

Accepted Solutions
alawton
Calcite | Level 5

It appears my problem was that i was trying to calculate the rate before encountering the numerator and denominator in the second occurence of the across variable. I solved the issue by re-sorting and applying noprint. Below is my corrected code:

proc report data=med_rec2 nowd;

columns service_line provider_speciality type, (enc nummeds numrec rate nummeds=new_den numrec=new_num );

define service_line / group 'Service Line';
define provider_speciality / group 'Service Line-/ Provider Specialty' style=[indent=20];
define type / across '';

define enc / analysis sum format=comma14. 'Patient/Encounters';

define rate / computed format=percent12.2 'Encounters 100%/Reconciled Within/24 Hrs of/Readmission';

define nummeds / noprint;

define numrec / noprint;

define new_den / analysis sum format=comma14. 'PTA Meds/Within24 Hrs/of Admission';

define new_num / analysis sum format=comma14. 'Meds #/Reconciled/Within 24 Hrs/of Admission';

break before service_line / summarize skip ol style=[background=skyblue indent=0];
compute before service_line;
provider_speciality=service_line;
endcomp;

rbreak after / summarize style=[font_weight=bold  font_size=12.50pt background=light gray indent=0];
compute after ;
provider_speciality='TOTAL';
endcomp;

compute rate;

_c6_ = _c5_ / _c4_;

_c12_ = _c11_ / _c10_;

endcomp;


run;

View solution in original post

1 REPLY 1
alawton
Calcite | Level 5

It appears my problem was that i was trying to calculate the rate before encountering the numerator and denominator in the second occurence of the across variable. I solved the issue by re-sorting and applying noprint. Below is my corrected code:

proc report data=med_rec2 nowd;

columns service_line provider_speciality type, (enc nummeds numrec rate nummeds=new_den numrec=new_num );

define service_line / group 'Service Line';
define provider_speciality / group 'Service Line-/ Provider Specialty' style=[indent=20];
define type / across '';

define enc / analysis sum format=comma14. 'Patient/Encounters';

define rate / computed format=percent12.2 'Encounters 100%/Reconciled Within/24 Hrs of/Readmission';

define nummeds / noprint;

define numrec / noprint;

define new_den / analysis sum format=comma14. 'PTA Meds/Within24 Hrs/of Admission';

define new_num / analysis sum format=comma14. 'Meds #/Reconciled/Within 24 Hrs/of Admission';

break before service_line / summarize skip ol style=[background=skyblue indent=0];
compute before service_line;
provider_speciality=service_line;
endcomp;

rbreak after / summarize style=[font_weight=bold  font_size=12.50pt background=light gray indent=0];
compute after ;
provider_speciality='TOTAL';
endcomp;

compute rate;

_c6_ = _c5_ / _c4_;

_c12_ = _c11_ / _c10_;

endcomp;


run;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 1 reply
  • 889 views
  • 0 likes
  • 1 in conversation