Announcement

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

  • Creating a Custom Table in STATA (read below)

    Hi

    I'm trying to create a table that on surface appears to be a cross tabulation, but in actuality it is not. For the row variables in the table, their Value Labels (for example if the row var is Sex) are not shown. The table looks as follows:

    Total Treatment Control

    Sex 100 50 50
    Income 97 49 48

    Sex is a nominal variable and Income is a continuous variable and the values shown in the cells are counts.. How can I create a table such as the above one in STATA? Any help or guidance will help

    Dev

  • #2
    If you are looking to just count non missing values across treatment and control, you might do it like this:

    Code:
    . sysuse auto, clear
    . table () (foreign), statistic(count length rep78) nototal
    
    ----------------------------------------
                       |      Car origin    
                       |  Domestic   Foreign
    -------------------+--------------------
    Length (in.)       |        52        22
    Repair record 1978 |        48        21
    ----------------------------------------
    To check what is being shown:
    Code:
    . bys foreign: count if !missing(length)
    
    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
    -> foreign = Domestic
      52
    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
    -> foreign = Foreign
      22
    
    . bys foreign: count if !missing(rep78)
    
    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
    -> foreign = Domestic
      48
    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
    -> foreign = Foreign
      21

    Comment

    Working...
    X