BookmarkSubscribeRSS Feed
Jackie_Stanbank
Calcite | Level 5
i want to export files to excel with certain color formats on the headings.

how can i do this?
1 REPLY 1
Peter_C
Rhodochrosite | Level 12
here is a quick example that shows how proc print can define color to be used in foreground, background and dynamic based on the value of the cell (although it is data cells for which dynamic background color is derived).[pre]ods _all_ close ;
ods tagsets.excelxp file='demo.xml'(title='test1') style= default ;
ods tagsets.excelxp options( sheet_name='col1' ) ;
proc format ;
value ages 0-9 ='gray'
10-12='green'
13-14='yellow'
15-16='orange' other='white' ;
run;
proc print data= sashelp.class ;
id name /style(head)=[background=blue foreground = white] ;
var sex /style(head)=[ foreground = gray ] ;
var age /style(head)=[background=orange ]
style(data)=[font_weight=bold background=ages.] ;
run;
ods _all_ close ;
dm 'winexecfile "demo.xml" ' ;
ods listing ;[/pre]Hope you'll find it helpful.
For better guidance, look into the examples and notes for using ods tagsets.excelxp at http://support.sas.com/rnd/base/ods/odsmarkup/ .

peterC sheet_name not sheetname was edited by: Peter.C

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 1 reply
  • 890 views
  • 0 likes
  • 2 in conversation