Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Richard Williams <richardwilliams.ndu@gmail.com> |
To | statalist@hsphsun2.harvard.edu, statalist@hsphsun2.harvard.edu |
Subject | Re: st: command stata |
Date | Thu, 25 Aug 2011 21:01:43 -0500 |
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: Richard.A.Williams.5@ND.Edu 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/