BookmarkSubscribeRSS Feed
gzr2mz39
Quartz | Level 8

The image does not appear when I use this line of code in my compute block
"if per_osha11.sum<per_osha10.sum".
However, if I change this line of my compute block to
"if per_osha11.sum<20"
the image shows up.
I'm using ods pdf to output this table.

Any ideas?
Thank you.

proc report data=task_tot5 nowd contents="Claims" out=test
style(header)=[font_weight=bold background=CX90D9D7];
options missing='0';
column task1 tot_osha11 per_osha11 tot_osha10 per_osha10 ;
define task1 / 'Task';
define tot_osha11 / analysis "Total 2011 YTD" style(column)={cellwidth=1in};
define per_osha11 / analysis "% of 2011 YTD Total" style(column)={cellwidth=1.1in};
define tot_osha10 / analysis "Total 2010" style(column)={background=CXECEDEC cellwidth=1in};
define per_osha10 / analysis "% of 2010 Total" style(column)={background=CXECEDEC cellwidth=1.1in};
rbreak after / summarize;
compute per_osha11;
  if task1 notin ("other*") then do;
   if per_osha11.sum<per_osha10.sum then
   call define (_col_,'style','style=[preimage="C:\GreenArrowDown.gif"]');
  end;
  if _break_="_RBREAK_" then per_osha11.sum=100;
endcomp;
run;

2 REPLIES 2
art297
Opal | Level 21

My guess would be that the two ten variables would have to come before the two 11 variables.  It would help if you could post all of the code and a sample dataset.

Ksharp
Super User

Because in your column statement , per_osha11 is before per_osha10, but proc report calculated from left to right.So you need use

compute per_osha10;

to tell sas what the per_osha10'value is.

Ksharp

Catch up on SAS Innovate 2026

Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.

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

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 2 replies
  • 1583 views
  • 0 likes
  • 3 in conversation