BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I am using the following to output the results of a stored process to Excel.

data _null_;
rc = stpsrv_header('Content-type','application/vnd.ms-excel;');
rc = stpsrv_header('Content-disposition',"attachment; filename=name.xls");
run;
%let _odsdest=tagsets.msoffice2k;
%let _odsstyle=sasweb;

My problem is that the output create a Traffic light report, but if a negative $ value is returned, the font is red. However, the background for that cell will also be red because of the traffic light rules. I need to be able to reset the format in Excel to make sure that the font color is black.

What do I need to do to send the desired font color to Excel?

Thanks for any clues.
KeithS
2 REPLIES 2
Cynthia_sas
SAS Super FREQ
Are you using PROC PRINT, PROC REPORT or PROC TABULATE for setting your traffic lighting?? User-defined format?? or CALL DEFINE??

The reason I ask is that, when I run this code in SAS (not as a stored process, just as a regular step), I get a red background color and black font in Excel.

You may want to contact Tech Support and have them look over your entire program and suggest how you can change your code to achieve what you want. It seems odd to me that your traffic lighting would make both the foreground and background color red.

cynthia

My foreground color is black when I submit this code:[pre]

data class;
set sashelp.class;
if age gt 14 then age = age * -1;
run;

proc format;
value agebk 1-high = 'white'
low-0 = 'red';
run;

ods msoffice2k file='trafic.xls' style=sasweb;
proc report data=class nowd;
column name age height;
define name /order;
define age /display style(column)={background=agebk.};
define height /display;
run;
ods _all_ close;[/pre]
deleted_user
Not applicable
Thank you for the response.

My code is producing HTML with a DATA _NULL_. The background in the is set based on values in the data. The Stored Process is run via the Information Delivery Portal.

Once again, thanks for the response and I will check with SAS support.

KeithS

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 2 replies
  • 1032 views
  • 0 likes
  • 2 in conversation