Hi
I am using sas version 9.1.3.
I want my proc tabulate to format some numeric variables using the format # ##0 (ie 17 324)and other numeric variables to have the format 12.1 (ie -8.4). This is the code I have tried:
ods tagsets.excelxp file='test.xml' style=custom ;
proc tabulate data=a style=[tagattr='format:# ##0'];
class year ;
var x y z ;
var xx ;
table year=' ', x y z xx / misstext='0' row=float ;
run ;
ods tagsets.excelxp close ;
which is close to what I want but of course does not give the desired format for the variable xx.
I then tried
ods tagsets.excelxp file='test2.xml' style=custom ;
proc tabulate data=a ;
class year ;
var x y z / style = {tagattr='format:# ##0'} ;
var xx / style = {tagattr='format:12.1'};
table year=' ', x y z xx / misstext='0' row=float ;
run ;
ods tagsets.excelxp close ;
This produces the undesirable result of formatting all variables with two decimal places and no separator ie 6112.46.
Any assistance greatly appreciated.
Thanks
C
TRY: proc tabulate data=a ; class year ; var x y z ; var xx ; table year=' ', x*{style = {tagattr='format:# ##0'} } y*{style = {tagattr='format:# ##0'} } z*{style = {tagattr='format:# ##0'} } xx / misstext='0' row=float ; run ;
Thanks so much Cynthia. Another question I have is: how do I add a horizontal line above and below the table? I have tried various options and nothing gives a horizontal line above the headings and a horizontal line below the last row, ie just above the footnotes.
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.