BookmarkSubscribeRSS Feed
TYT88
Calcite | Level 5

I have the following script that sends an email out with a table

I need the columns to be in specific size and hence I used the width style

The output is fine in SAS whereby the width is as per setting but not in ODS HTML

It seems like the table is adjusted to fit content of the table instead


FILENAME output EMAIL
FROM = ("xxx")
SENDER = ("xxx")
TO = ("xxx")
SUBJECT = ("testing")
CONTENT_TYPE="text/html";
ODS HTML BODY=output options(pagebreak='no') style =MYSTYLE;


PROC TABULATE DATA=sashelp.shoes;

CLASS product region;
classlev product / s=[width=10.75in];
classlev region / s=[width=10.75in];
VAR sales inventory returns / s=[width=5in];


TABLE product ='',
region =''*(sales*SUM=''
inventory*SUM=''
returns*SUM='')
/BOX={S=[width=10.75in]};
RUN;


ODS _ALL_ CLOSE;
FILENAME output CLEAR;

 

 

3 REPLIES 3
ChrisNZ
Tourmaline | Level 20

1. VAR sales inventory returns / s=[width=5in];  So that's 15 in.

  classlev region / s=[width=10.75in];  That's less than 15 in. How is it supposed to fit?

 

2. You have 15 in per region. Do you really want a report 4 feet wide?

 

3. Can you look at the generated html so we see what the coded width looks like?

I suspect SAS sets it correctly, but the viewer/browser chooses to shrink the table as sensibly as it sees fit. 

 

  

TYT88
Calcite | Level 5

Thanks for reply

The huge width is set on purpose to show that it didn't work

Anyway, I tested with a few width and found out that it works for small table but not big table

Unfortunately, my data is big table, so I did a workaround to use blank spaces to control the width and it works

 

ChrisNZ
Tourmaline | Level 20

I suspect that SAS sets it correctly, but the viewer/browser chooses to shrink the table as sensibly as it sees fit. 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

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
  • 3 replies
  • 1232 views
  • 0 likes
  • 2 in conversation