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
SAS Super FREQ

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
SAS Super FREQ

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;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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