Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: estout, problem aligning output when adding a column of values


From   "Paul Shattuck" <[email protected]>
To   <[email protected]>
Subject   st: estout, problem aligning output when adding a column of values
Date   Fri, 25 Sep 2009 10:16:37 -0500

Hello,

Thank you all for your very helpful comments on previous posts related
to estout. I am extremely grateful.

I am having difficulty figuring out how to A) have estout include a
column for the subpopulation observation frequency counts (unweighted)
after svy:tab that includes a subpopulation(if x==1) statement, and B)
include blank spaces in the stats command so that the scalar I want in
the last row of the table is in the last column. 


This is the table format I'd like to end up with. The b is the weighted
%, ObsSub is the unweighted sample n, N_sub is the total unweighted
number of cases in the subsample defined by the svy:tab subpop command.
This format for a table of descriptive univariate sample characteristics
is being asked for by a particular journal I'm submitting to.

estpost svy brr, subpop(if x==1) mse: tab  race4 , obs percent ci


Race-ethnicity
----------------------------------------------------------------
	                b           lb           ub         ObsSub
----------------------------------------------------------------
White                74.8         66.8         81.3        228.0     
African-Am~n         14.6         10.3         20.4         66.0     
Hispanic              7.2          3.3         15.1         17.0      
Other                 3.4          1.5          7.8         10.0     
----------------------------------------------------------------
N_sub	                                                     321.0
----------------------------------------------------------------




This is the best I've been able to come up with after hours of
experimenting and studying the estout help files and examples online:


estout , cell("b(f(1)) lb(f(1)) ub(f(1)) ObsSub(transpose)")
title(Race-ethnicity) ///
	mlabels(none) drop(Total)  stats(N_sub, layout("^ ^ ^ @")) 


Race-ethnicity
----------------------------------------------------------------
                        b           lb           ub       ObsSub
----------------------------------------------------------------
White                74.8         66.8         81.3             
African-Am~n         14.6         10.3         20.4             
Hispanic              7.2          3.3         15.1             
Other                 3.4          1.5          7.8             
r1                                                         228.0
r2                                                          66.0
r3                                                          17.0
r4                                                          10.0
----------------------------------------------------------------
^ ^ ^ N_sub                                                321.0
----------------------------------------------------------------


///here is a list of ereturn elements from the tabulation///
//e(ObsSub) is a 4 x 1 e matrix of values, but e(b) is 1 x 5. That is
why the estout command above includes the transpose option///

ereturn list

scalars:
             e(stages) =  1
             e(census) =  0
          e(singleton) =  1
               e(df_r) =  330
                  e(N) =  4693
           e(N_strata) =  45
      e(N_strata_omit) =  15
              e(N_psu) =  375
              e(N_pop) =  1800833.620000002
              e(N_sub) =  321
           e(N_subpop) =  6869.119999999999
                  e(r) =  4
                  e(c) =  1
              e(total) =  6869.119999999999
             e(mgdeff) =  .
            e(cvgdeff) =  .
               e(rank) =  3
              e(level) =  95

macros:
             e(subcmd) : "tabulate"
                e(cmd) : "estpost"
         e(properties) : "b V"
             e(depvar) : "Mean"
            e(strata1) : "Stratum"
                e(su1) : "Cluster"
                e(mse) : "mse"
         e(singleunit) : "centered"
               e(wexp) : "= np4Wt"
               e(wvar) : "np4Wt"
              e(wtype) : "pweight"
                e(vce) : "linearized"
            e(vcetype) : "Linearized"
             e(setype) : "cell"
             e(subpop) : "if autism680==1 & InSchInPastYear==0  &
nomiss_pos.."
             e(rowvar) : "race4"
            e(rowvlab) : "Race-ethnicity"
             e(rowlab) : "label"
          e(estat_cmd) : "svy_estat"
            e(predict) : "_no_predict"
       e(marginsnotok) : "_ALL"
            e(cmdname) : "tabulate"
             e(prefix) : "svy"
            e(cmdline) : "svy brr, subpop(if autism680==1 &
InSchInPastYear=.."

matrices:
                  e(b) :  1 x 5
           e(obsuball) :  1 x 5
                 e(se) :  1 x 5
                 e(lb) :  1 x 5
                 e(ub) :  1 x 5
               e(deff) :  1 x 5
               e(deft) :  1 x 5
               e(cell) :  1 x 5
              e(count) :  1 x 5
                e(obs) :  1 x 5
          e(_N_strata) :  1 x 1
   e(_N_strata_single) :  1 x 1
  e(_N_strata_certain) :  1 x 1
                e(Obs) :  4 x 1
             e(ObsSub) :  4 x 1
               e(Prop) :  4 x 1
                e(Row) :  1 x 4
                e(Col) :  1 x 1
              e(V_row) :  4 x 4
              e(V_col) :  1 x 1
               e(Deff) :  1 x 4
               e(Deft) :  1 x 4
              e(V_srs) :  4 x 4
           e(Deff_row) :  1 x 4
           e(Deft_row) :  1 x 4
          e(V_srs_row) :  4 x 4
           e(Deff_col) :  1 x 1
           e(Deft_col) :  1 x 1
          e(V_srs_col) :  1 x 1

functions:
             e(sample)   





Paul T. Shattuck, Ph.D.


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index