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;
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.
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
I suspect that SAS sets it correctly, but the viewer/browser chooses to shrink the table as sensibly as it sees fit.
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!
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.
Ready to level-up your skills? Choose your own adventure.