Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: Rownames for tabulate from Stata macros?


From   "Kanter, Rebecca" <[email protected]>
To   "[email protected]" <[email protected]>
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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index