BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
kimdukes77
Obsidian | Level 7

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;

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

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.

 

 

 

 

View solution in original post

4 REPLIES 4
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.

 

ballardw
Super User

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.

 

 

 

 

kimdukes77
Obsidian | Level 7

Works a treat!  Was trying to adjust the row variable headers.  Thanks for your help!

Ksharp
Super User

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;

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 5091 views
  • 2 likes
  • 4 in conversation