Does your nice-looking report occasionally have very long character values that dominate the screen real estate? If so, the flyover style attribute may be just what you need. In the example below, PROC REPORT is used to generate a report. A compute block is used to check the length of the long character variable and if it is longer than some pre-determined length (e.g., 20 characters), only the first 20 characters are displayed and the rest of the string is displayed using the flyover attribute.
ods listing close;
ods html file='\temp.html';
ods pdf file='\temp.pdf' notoc;
options noquotelenmax;
proc report data=sashelp.vslib nowd;
columns libname path;
compute path;
if length(path) > 20 then
do; /* only show first 20 chars, use flyover for remainder */
flyoverText = '...'||substr(path,21);
path = substr(path,1,20)||'...';
call define(_col_,'style','style=[flyover="'||strip(flyoverText)||'"]');
end; /* only show first 20 chars, use flyover for remainder */
endcomp;
run;
ods _all_ close;
A few additional points about this example:
- The use of the SAS Tip:Using the NOQUOTELENMAX Option option to suppress the erroneous mismatched quotes warning message.
- The flyover attribute works in both the HTML and PDF destinations.
- Generating both HTML and PDF output at the same time.
- Use of ods _all_ close; to close both destinations.
- The maximum length could be specified using a macro variable.
- The maximum length that can be displayed in the HTML destination is dependent on the browser. If the generated flyover text is too long, your browser may truncate the value.
Thanks to Don Henderson for sharing this tip on sasCommunity.org.