BookmarkSubscribeRSS Feed
metallon
Pyrite | Level 9

 

 

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;

1 REPLY 1
ballardw
Super User

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).

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 923 views
  • 0 likes
  • 2 in conversation