The SAS Output Delivery System and reporting techniques

Proc Report Flyover Text in PDF

Reply
N/A
Posts: 0

Proc Report Flyover Text in PDF

I have the following proc report code:

columns LVL_2 inj_yr, (lost1 avg_emp rate1);
define LVL_2 / group 'Departments;
define inj_yr / across '' ;
define rate1 / analysis 'Rate' width=5;
define avg_emp / analysis 'Avg Emp';
define lost1 / analysis noprint;
compute rate1;
if _c4_>&hi05 then call define ('_c4_',"style","style=[foreground=red]");
attrib='style={flyover="Lost: _c2_"}';
call define('_c4_','style',attrib);
endcomp;

How do I reference the column _c2_? The flyover text works fine, but I'm not sure how to show the actual values for _c2_.
Also, I lose foreground=red when I apply the flyover text. Is it possible to have both the flyover text and foreground=red?
I output to PDF.
Thanks,
Jason
Super Contributor
Super Contributor
Posts: 3,174

Re: Proc Report Flyover Text in PDF

Suggestion: it is not necessary to post a particular item in more than one forum.
Super Contributor
Posts: 394

Re: Proc Report Flyover Text in PDF

_c2_ is a variable so you reference its value just like any other variable. In this case that means creating the attrib string using the concatenation operator.
[pre]
attrib='style={flyover="Lost: ' || _c2_ || '"}';
[/pre]
Now, regarding getting both style attributes at the same time. What's happening is that each call to the DEFINE routine with a style element replaces any previously defined style elements. The last call always wins.

The solution, like so many solutions in this forum, depends on what version of SAS you're using. If you're using 9.2, PROC REPORT supports the "STYLE/MERGE" attribute.
[pre]
call define(_c4_, "style/merge", attrib);
[/pre]
"STYLE/MERGE" tells the DEFINE routine to merge the style element with the existing style elements. With "STYLE/MERGE", the flyover attribute gets merged with the foreground attribute and so both are used.

If you're using an earlier version of SAS, you have to specify both the flyover attribute and the foreground attribute in the same call to DEFINE.
[pre]
attrib='style={foreground=red flyover="Lost: ' || _c2_ || '"}';
[/pre]
Here's the doc for STYLE/MERGE and its companion STYLE/REPLACE:
http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/a002473624.htm
N/A
Posts: 0

Re: Proc Report Flyover Text in PDF

I have SAS 9.1/EG 4.1
The correct flyover values now appear, however, I'm not sure how to get foreground=red to be correctly applied:
if _c7_>&hi06 then call define ('_c7_',"style","style=[foreground=red]");
if _c4_>&hi05 then call define ('_c4_',"style","style=[foreground=red]");
attrib='style={flyover="Lost: ' || _c2_ || '"}';
call define('_c4_','style',attrib);
attrib='style={flyover="Lost: ' || _c5_ || '"}';
call define('_c7_','style',attrib);

Thank you.
SAS Super FREQ
Posts: 8,740

Re: Proc Report Flyover Text in PDF

Hi:
If you were using SAS 9.2, you could use STYLE/REPLACE or STYLE/MERGE in your CALL DEFINE to apply the red foreground color.

In SAS 9.1.3, I believe your only choice would be to explicitly set the foreground where you set the flyover. It looks like _c4_ and _c7_ will always have some kind of flyover. You could do this (I may not have the logic of what you want to do quite correct -- I was just guessing):

[pre]

if _c7_ > &hi06 then do;
attrib='style={foreground=red flyover="Lost: ' || _c5_ || '"}';
call define ('_c7_',"style",attrib);
end;
else do;
attrib='style={foreground=black flyover="Lost: ' || _c5_ || '"}';
call define ('_c7_',"style",attrib);
end;
[/pre]

cynthia
N/A
Posts: 0

Re: Proc Report Flyover Text in PDF

This works well.
Thank you.
Ask a Question
Discussion stats
  • 5 replies
  • 241 views
  • 0 likes
  • 4 in conversation