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: Rownames for tabulate from Stata macros?


From   "Kanter, Rebecca" <rkanter@jhsph.edu>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: Rownames for tabulate from Stata macros?
Date   Wed, 18 Jul 2012 21:27:38 -0400

Hi,

I very much appreciate your help on this matter.

I am running a two-way (svy) tabulates such as:

svy: tabulate highested_level bmicat3 

*where highested_level is a categorical variable with each category having its own variable label (0 "no education" 1 "primary" 2 "secondary" 3 "higher").


However, I cannot figure out how to store the rownames in macros such as can be done using tab-stat-example here:


. tabstat bmicat3, by(highested_level) save

Summary for variables: bmicat3
     by categories of: highested_level (highest educational level)

highested_level |      mean
----------------+----------
   no education |  .3087435
        primary |  .3112224
      secondary |  .3200342
         higher |  .3525896
----------------+----------
          Total |  .3136042
---------------------------

. return list

macros:
              r(name4) : "higher"
              r(name3) : "secondary"
              r(name2) : "primary"
              r(name1) : "no education"


Does anyone know how I can get similar macros r(name1), r(name2), r(name3), and r(name4) from the svy two-way tabulate??

I want to be able to run a tabulate loop on many variables without having to manually enter the rownames for each different categorical variable.

Thanks so much for your help,
Rebecca

___________________________________________
Rebecca M. Kanter, PhD
Johns Hopkins Bloomberg School of Public Health
Department of International Health
Center for Human Nutrition
*
*   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