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

I am adding up tot_osha and per_osha using rbreak summarize.
However, I would like to change the sum of per_osha to 100.
How do I accomplish this?
Thank you.

proc report data=csbu3 nowd contents="Claims" out=test
style(header)=[font_weight=bold background=CX90D9D7 /*very light bluish green*/];
options missing='';
column ydoi1 task1 tot_osha per_osha;
define ydoi1 / noprint;
define task1 / 'Task';
define tot_osha / analysis "2011 YTD Total" style(column)={background=CXE599A7};
define per_osha / analysis "% of 2011 Total" style(column)={background=orange};
rbreak after / summarize;
compute per_osha;
  if _break_="_RBREAK_" then per_osha=100;
endcomp;
run;

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
Diamond | Level 26

Hi:

  When you use an ANALYSIS variable in a COMPUTE block, you must use the compound form of the name for reference in syntax:

itemname.statisticname

For example, if you had these DEFINE statements:

define age / mean 'Age';

define amount / analysis 'Amt';

define total / sum 'Tot';

define change / min 'Minimum';

Then the COMPUTE block references would be:

AGE.MEAN

AMOUNT.SUM

TOTAL.SUM

CHANGE.MIN

A usage of ANALYSIS implies the SUM statistic, so the compound name for your item would be:

PER_OSHA.SUM

cynthia

View solution in original post

2 REPLIES 2
Cynthia_sas
Diamond | Level 26

Hi:

  When you use an ANALYSIS variable in a COMPUTE block, you must use the compound form of the name for reference in syntax:

itemname.statisticname

For example, if you had these DEFINE statements:

define age / mean 'Age';

define amount / analysis 'Amt';

define total / sum 'Tot';

define change / min 'Minimum';

Then the COMPUTE block references would be:

AGE.MEAN

AMOUNT.SUM

TOTAL.SUM

CHANGE.MIN

A usage of ANALYSIS implies the SUM statistic, so the compound name for your item would be:

PER_OSHA.SUM

cynthia

gzr2mz39
Quartz | Level 8

Cynthia's answer is correct.

Here is what the code looks like:

computer per_osha;

if _break_="_RBREAK_" then per_osha.sum=100;

endcomp;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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