Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | "Yang, Chongmin" <chongminyang@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: grouping cases |
Date | Sat, 8 Oct 2011 08:25:11 +0900 |
Thanks, Daniel. I think your method is more convenient. 2011/10/8 daniel klein <klein.daniel.81@googlemail.com>: > Maybe working with numeric variables might be more convenient here. > Assuming that there are no typing errors in "country" you can fristly > -encode- this variable. You then create the dummy using a numeric > variable. > > . encode country ,g(cntry) > . la li cntry > . g oecd = inrange(cntry, 1, 5) | inrange(cntry, 12, 14) ... > [fictional numbers !] > > For the second step you may also use -todummy- ,(available from SSC). > The syntax would then be something like > > . todummy mk ,v(1/5 12/14) g(oecd) > > Even if you cannot use -inrange()- or the like, I guess it is still > more convenient to write "12" instead of writing "Korea, Republic of". > > Best > Daniel > > -- > > I want to choose oecd members from all countries and make dummy variables. > So I wrote like this way: > > gen oecd=1 if country=="Australia" | country=="Austria" | > country=="Belgium" | country=="Canada" | > [...] > * > * 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/ > * * 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/