Hello,
I am trying to use ODS to create a formatted table in Excel via SAS. I'm actually most of the way there, but I was hoping to get help with a few more steps I'd like to take to perfect it.
My questions are:
1. Is there a way to eliminate the blank row automatically created between the title and the column headers?
2. Why isn't my Team column header centered (see code below)?
3. Is there a way to do a middle alignment in Excel via SAS (ie, have my text vertically centered in the Excel cell)?
This is the code I'm using:
ods _all_ close ;
ods tagsets.ExcelXP path='c:\excel sheets'
file="TotalWins.xml"
style=listing;
title font=trebuchet bold bcolor=grey justify=center
'Wins by Team';
ods tagsets.Excelxp options(embedded_titles='yes' embedded_footnotes='yes'
print_header='&C&A');
ods tagsets.excelxp options(sheet_name='Wins by Team');
proc print data=Winsbyteam noobs style(header)=[background=silver
font_size=10pt just=center font_face=Trebuchet font_weight=bold];
var Team/style(column)=[font_face=trebuchet font_size=8pt] ;
var winrec/style(column)=[just=center font_face=trebuchet font_size=8pt];
run;quit;
ods tagsets.ExcelXP close;
run;
Any help is much appreciated. Thanks!
Hi.
Would it be possible to post a small sample data?
Anca.
My raw data or the Excel spreadsheet?
Sample raw data.
Sure.
It's just two columns with a list of Little League Teams and a count of how many times that team has won.
So:
Team Wins
Tigers 10
Jackals 5
Comets 7
Marlins 12
Thunder 15
etc
For 1, check the skip_space options in ODS Tagsets
Re #3. The link I sent also seems to suggest that center in proc report can be used to center variables if required.
See the example under:
I usually use something like the following for titles, but not sure it works in tagsets:
ods eschapechar="^";
title "^{style [color=Black fontsize=14pt font_face=georgia just=center] Teams by Win}";
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.