Help using Base SAS procedures

color formats in Excel formats

Reply
Occasional Contributor
Posts: 11

color formats in Excel formats

i want to export files to excel with certain color formats on the headings.

how can i do this?
Valued Guide
Posts: 2,168

Re: color formats in Excel formats

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
Ask a Question
Discussion stats
  • 1 reply
  • 85 views
  • 0 likes
  • 2 in conversation