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

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
  • 686 views
  • 0 likes
  • 3 in conversation