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.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.