BookmarkSubscribeRSS Feed
rajd1
Quartz | Level 8

I have been trying to get some customized outputs in excel format and for some reason the indenting of the row headings in the categorical table is not working. The sheet name for the tabulate works and not for the second. Also, i want a nicer cleaner looking table where i can easily transport it to a word document. Any tips on making this table better will be helpful.

 

Can i also make the same tables by another dimension using the county variable? For example separate table by X,Y,and Z. THANK YOU!

 

data testing;
input Name $ County $ MaxRun MinRun RUNS FIRSTD LASTD TIME Reduce $ Increase $;
datalines;
A X 5 2 4 130 135 122 No Yes
A X 5 2 4 870 885 122 No Yes
B Y 7 1 7 660 610 220 Yes No
B Y 7 1 7 660 610 220 Yes No
B Z 7 1 7 660 610 220 Yes No
C Z 3 1 5 485 430 220 Yes No
C X 4 1 4 195 190 220 Yes No
C X 4 1 4 195 190 220 Yes No
D Y 5 1 5 575 485 106 Yes No
D Y 5 1 5 800 795 106 Yes No
D Z 6 3 3 103 106 210 No Yes
A Z 6 1 6 590 585 210 Yes No
A X 9 1 9 835 870 210 No Yes
B X 9 1 9 835 870 210 No Yes
C Y 2 2 1 165 165 620 No No
C Y 1 3 9 112 535 234 Yes No
C Z 1 3 9 112 535 234 Yes No
;

/*Summary for quantitative variables*/
ODS TAGSETS.EXCELXP
file="path\check info.xml"
STYLE=statistical
OPTIONS (embedded_titles='yes' embedded_footnotes='yes' FitToPage = 'yes'
sheet_name="Quantitative" Orientation = 'landscape');
title "Quant Table";
proc tabulate data= Testing format=comma11.2;
CLASS county;
var MaxRun MinRun RUNS FIRSTD LASTD TIME;
table County * (MaxRun='Maximum Runs' MinRun='Minimum Runs' RUNS='RUNS' FIRSTD='1st' LASTD='Lst' TIME='TT'),(N mean*f=9.1 median*f=9.1 std*f=9.2)/rts=25 INDENT=4;
keylabel ALL = 'Total'
mean = 'Mean'
median = 'Median'
std = 'SD';
run;
/*Summary for categorical variables*/
STYLE=statistical
OPTIONS (embedded_titles='yes' embedded_footnotes='yes' FitToPage = 'yes'
sheet_name="Categorical" Orientation = 'landscape');
title "Categorical Table";
proc tabulate data= testing NOSEPS format=comma11.2;
class Reduce Increase/ missing;
table (Reduce='' Increase=''), (all pctn)/rts=25 INDENT=4;
keylabel
pctn = '%';
run;
ods tagsets.ExcelXP close;
ods html close;
run;

4 REPLIES 4
ballardw
Super User

Without data to test anything I will make a couple of suggestions.

One would be to add leading spaces to the values and then use a CLASSLEV statement with the option Style=[asis=on] to protect the leading spaces, or use the option with a format that provides the leading spaces.

 

RTS= doesn't have any affect outside of Listing output, same with NOSEPS.

You might want to control the row column headings with a Classlev option of width=XX and provide a unit such as inches or cm with XX being the number of units for the column.

 

 

rajd1
Quartz | Level 8
I have edited the post with a dataset. thanks
Cynthia_sas
SAS Super FREQ

Hi:

  I can do an indent as a style override with ODS EXCEL, but it doesn't work with TAGSETS.EXCELXP. The issue you're running into is that RTS and NOSEPS and INDENT as you show them are LISTING only options that are ignored by ODS destinations.

 

  This worked for me:

Cynthia_sas_0-1591666060459.png

 

  Note that I have INDENT= in my code as a STYLE override on the VAR statement.

 

Hope this helps,

Cynthia

rajd1
Quartz | Level 8
Thanks for this! I have edited my post with a dataset. Please see the post. Thank you

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!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1950 views
  • 0 likes
  • 3 in conversation