Announcement

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

  • tabout error - conformability error, function returned error

    Hello,

    I am attempting to include multiple variables in a oneway table. I am using the tabout command from ssc by Ian Watson. Here is my code:

    Code:
    sysuse auto, clear
    tabout make price mpg using table.tex, cells(n) sum oneway replace
    I am getting the following errors:

    subinstr(): 3200 conformability error
    sum_output(): - function returned error
    <istmt>: - function returned error


    The help file specifies that the sum and oneway commands may be necessary when making oneway tables, so I'm not sure why I'm getting these errors. Any ideas are appreciated.

  • #2
    You have a syntax error, but tabout doesn't check for the error and thus you wind up with uninformative error messages. Consider
    Code:
    . tabout foreign using table.txt, cells(n) sum oneway replace
                  subinstr():  3200  conformability error
                sum_output():     -  function returned error
                     <istmt>:     -  function returned error
    r(3200);
    which reproduces your error. The output of help tabout tells us that N, like any other statistic in the cells option, must be followed by a variable name - it is going to report the number of non-missing observations of that variable. So we try
    Code:
    . tabout foreign using table.txt, cells(n foreign) sum oneway replace
    
    Table output written to: table.txt
    
    Car type        N
            foreign
    Domestic        
    Foreign 
    Total
    which while not failing with an outright error, fails to produce the desired output. A return to the output of help tabout reminds us that the staitstic in "N" rather than "n". And we then have
    Code:
    . tabout foreign using table.txt, cells(N foreign) sum oneway replace
    
    Table output written to: table.txt
    
    Car type        N
            foreign
    Domestic        52.0
    Foreign 22.0
    Total   74.0

    Comment

    Working...
    X