Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to alter table column width using putpdf table?

    Hi all,

    This is my first time posting here in the Forum, so please pardon me if I miss anything.

    I am using Stata 16.1. I was trying to alter the column width of a table generated using "putpdf table" command. I read through the documentation and did a lot search, but still could not find a way to do this. Below is an example for illustration (borrowed from Huebler).

    Code:
    sysuse auto,clear 
    putpdf clear
    putpdf begin, font("Arial",9)
    putpdf paragraph, spacing(line, 1 pt)
    putpdf text ("Table 1"), bold
    putpdf table tab1 = data(make price mpg rep78) in 1/10, varnames
    forval i = 1/11 {
      putpdf table tab1(`i',.), valign(center)
    }
    
    putpdf save tabletest.pdf, replace
    The resulting table is shown below. What I hope to achieve is to change the width of a specific column: e.g. expand only the first column and narrow the rest to save length/maximize the use of space. Can someone help me with this?
    Click image for larger version

Name:	testtable.PNG
Views:	1
Size:	34.5 KB
ID:	1613594



    Many thanks in advance,
    Di

  • #2
    The width option is what you need. Here I set the first column to 55% of the table width, the second to 25%, and the final two to 10% each, adding up to 100% as is required.
    Code:
    matrix w  = (55, 25, 10, 10)
    putpdf table tab1 = data(make price mpg rep78) in 1/10, varnames width(w)

    Comment


    • #3
      Originally posted by William Lisowski View Post
      The width option is what you need. Here I set the first column to 55% of the table width, the second to 25%, and the final two to 10% each, adding up to 100% as is required.
      Code:
      matrix w = (55, 25, 10, 10)
      putpdf table tab1 = data(make price mpg rep78) in 1/10, varnames width(w)
      Many thanks, William!! This is awesome. Exactly what I am looking for.

      Comment

      Working...
      X