Help using Base SAS procedures

Proc Report - Across and Compute Issue

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 12
Accepted Solution

Proc Report - Across and Compute Issue

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;


Accepted Solutions
Solution
‎11-14-2014 11:13 AM
Occasional Contributor
Posts: 12

Re: Proc Report - Across and Compute Issue

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


All Replies
Solution
‎11-14-2014 11:13 AM
Occasional Contributor
Posts: 12

Re: Proc Report - Across and Compute Issue

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;

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 1 reply
  • 183 views
  • 0 likes
  • 1 in conversation