Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

st: Descriptive tables crossing 2 class variables with multiple statistics for a third variable


From   Dan Waldo <dan_waldo@yahoo.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: Descriptive tables crossing 2 class variables with multiple statistics for a third variable
Date   Mon, 10 May 2010 16:14:04 -0700 (PDT)

Dear list members,
I would very much like to move some SAS code over to Stata, but I do not seem able to find a table command that would produce the same type of output I have at present.
I have 3 class variables and one analytic variable. In the example below the class variables are agegrp, eligibility, and sex, and the analytic variable is wtfa. The table I hope to generate would be:
         |     agegrp      |       agegrp        |  agegrp   |
         |-----------------+---------------------+-----------|
         | 63-64  | 65-66  |  63-64   |  65-66   |     |     |
         |--------+--------+----------+----------|     |     |
         |   N    |   N    |   Sum    |   Sum    |63-64|65-66|
---------+--------+--------+----------+----------+-----+-----|
All      |     943|     956| 4,183,891| 4,112,111|100.0|100.0|
eligible |        |        |          |          |     |     |
  No     |      83|      72|   354,928|   272,421|  8.5|  6.6|
  Yes    |     860|     884| 3,828,963| 3,839,690| 91.5| 93.4|
Sex      |        |        |          |          |     |     |
  1 M    |     458|     440| 2,018,286| 1,852,086| 48.2| 45.0|
  2 F    |     485|     516| 2,165,605| 2,260,025| 51.8| 55.0|

which comes from the SAS code
proc tabulate data=descriptive;
   var wtfa;
   class agegrp eligible sex;
   table all eligible sex ,
      agegrp*wtfa*n agegrp*wtfa*sum agegrp*wtfa*colpctsum;
      run;

Will somebody kindly point me to the appropriate Stata command(s) that do the same job?

Thanks!


      

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index