I am using Proc Tabulate with ODS PDF and one table created spans more than one page. On the second page, the column widths adjust to fit which makes the table look unslightly.
I have tried using the cellwidth style attribute to fix the column size but it isn't working although code runs with no errors.
Can anyone help? Code below.
proc tabulate data=_tmp_country_t missing;
class hodo1 country year order;
var total;
format hodo1 $highdom.;
format order $orderout.;
table hodo1='' * [style= [cellwidth=7cm]] * country='', order ='' * year='' * total='' * sum='' * format=7. / misstext='0';
run;
Are you trying to set the width of the 1)Row header variables (hodo country), or 2) the column header variables (order year) or 3) statistics?
Each level of nesting would need to be addressed. With Class variables usually the better approach is on a CLASSLEV statement:
Classlev hodo1 /style= [width=7cm] ;
Set for each variable as needed.
If you need uniform column headings set them but watch for interactions due to NESTING.
Using ORDER * YEAR a specified width for ORDER would have to be large enough to handle all of the Years plus padding and such. Specifying a width for Year or the SUM statistic might be in order for uniformity.
Well I don't generally use tabulate anymore. I would put the results out to a dataset, with an out=, then proc report it. But looking at the code you give, inline style attribution has to be escaped e.g.:
ods escapechar='^';
title 'This title ^s={font-size=12} is big';
The ^ in this case is used as an escape character.
Are you trying to set the width of the 1)Row header variables (hodo country), or 2) the column header variables (order year) or 3) statistics?
Each level of nesting would need to be addressed. With Class variables usually the better approach is on a CLASSLEV statement:
Classlev hodo1 /style= [width=7cm] ;
Set for each variable as needed.
If you need uniform column headings set them but watch for interactions due to NESTING.
Using ORDER * YEAR a specified width for ORDER would have to be large enough to handle all of the Years plus padding and such. Specifying a width for Year or the SUM statistic might be in order for uniformity.
Works a treat! Was trying to adjust the row variable headers. Thanks for your help!
You can change the following system option to make your PDF size as big as you can hold all this tabulate.
options papersize=(10in 20in);
proc tabulate data=sashelp.class;
class sex age;
var weight;
tables sex*age,weight*(mean std);
run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.