The SAS Output Delivery System and reporting techniques

calculate percentages on breake

Reply
Frequent Contributor
Posts: 133

calculate percentages on breake

 

 

Hi SAS Experts,

I noticed that the the proc report sums the percentages on the breake. Which does not make sense in my case.

How can I "re"-calculate the percentages for the break/totals e.g. BIGORG_CODE?

 

proc report data=DATASELECT_BIGORG;
COLUMN BIGORG_CODE BIGORG_MATRIX MATRIX_GROUP_TEXT
('Source'
        ('COUNTRYX'(
                                 ('' COUNT_COUNTRYX)
                                         ('' RHG_COUNTRYX) )
                     ('' RHG_COUNTRYX_PERCENT)
                     ('' RHGBEANSTAN_COUNTRYX)
                     ('' RHGBEANSTAN_COUNTRYX_PERCENT))
 );
DEFINE BIGORG_CODE / GROUP 'Code';
DEFINE MATRIX_GROUP_TEXT / 'Main Group';
DEFINE BIGORG_MATRIX / 'Matrix';

DEFINE COUNT_COUNTRYX /  'n';
DEFINE RHG_COUNTRYX /  '>RHG';
DEFINE RHG_COUNTRYX_PERCENT /  '%' format=nlnum20.1;

BREAK AFTER BIGORG_CODE / summarize style=[backgroundcolor=#C8CCA8 fontsize=1 fontfamily=arial];

 

/*coloring*/
COMPUTE RHG_COUNTRYX_PERCENT;
IF RHG_COUNTRYX_PERCENT.SUM > 1 AND RHG_COUNTRYX_PERCENT.SUM ne . THEN call define(_col_,"style","style={background=#2F75B5 foreground=white fontsize=1}");
ENDCOMP;
run;

Grand Advisor
Posts: 10,196

Re: calculate percentages on breake

Since you don't define a statistic in your DEFINE statements report is using the default SUM for the varaibles. Since Proc Report isn't calculating the percents but just lisint values you provided, it can't calculate a summary percent (at least not without a fair amount of work on your part for coding the summary).

Ask a Question
Discussion stats
  • 1 reply
  • 268 views
  • 0 likes
  • 2 in conversation