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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

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
  • 792 views
  • 0 likes
  • 2 in conversation