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]

Re: st: command stata


From   Donsaane Dontsi Saatena <[email protected]>
To   [email protected]
Subject   Re: st: command stata
Date   Thu, 25 Aug 2011 21:09:48 -0400

Thanks Richard.

That is if I understand I can do : egen infrastructures = group (roads, water, electricity)?




Richard Williams <[email protected]> a écrit&nbsp;:

At 06:51 PM 8/25/2011, Donsaane Dontsi Saatena wrote:
Hi,

I am looking for stata's command in order to group many variables into
one. Let's say we have: roads, water , electricity, and we want to
group them into one variable: infrastructures.
could someone help me with the command?

thanks

Does -egen- with the group function do what you want? e.g.

. webuse nhanes2f, clear
. egen grp = group(sex race), label
. tab1 grp

-> tabulation of grp

   group(sex |
       race) |      Freq.     Percent        Cum.
-------------+-----------------------------------
  Male White |      4,306       41.66       41.66
  Male Black |        500        4.84       46.49
  Male Other |        103        1.00       47.49
Female White |      4,745       45.90       93.39
Female Black |        586        5.67       99.06
Female Other |         97        0.94      100.00
-------------+-----------------------------------
       Total |     10,337      100.00



-------------------------------------------
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
HOME:   (574)289-5227
EMAIL:  [email protected]
WWW:    http://www.nd.edu/~rwilliam

*
*   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/





Donsaane

*
*   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