Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: recode,


From   Ernest Berkhout <ernestb@seo.fee.uva.nl>
To   statalist@hsphsun2.harvard.edu
Subject   st: Re: recode,
Date   Tue, 25 May 2004 16:36:04 +0200

At 16:28 25/05/2004, Annelies wrote:

recoding might work (you may have noticed that I'm not a stata expert),
but like Nick Cox mentioned, it's important to me that I can easily look
up what I did months later, and for that I don't think recoding is very
clear.
But, what would happen if i would use recode, and some of the old country
specific codes are the same as the new origin (country group)codes? (this
is, in fact, the case).

example (fake):
natio 1 = south africa
natio 2 = somalia
natio 3 = argentina
natio 4 = russia
natio 5 = slovenia
natio 6 = the netherlands
-gen origin = natio
-recode origin 1 2=4 3=3 4 5=2 6=1
now I should have:
origin 1 (netherlands) includes natio 6(netherlands)
origin 2 (eastern europe) includes natio 4, 5 (russia, slovenia)
origin 3 (latin america) includes natio 3 (argentina)
origin 4 (africa) includes natio 1, 2 (south africa, somalia)

but I think I would have:
origin 1 does not exist, it's overwritten because it first became 4, but
then 4 was recoded in 2, so that now origin 2 (eastern europe) includes
not only natio 4 and 5, but also natio 1 and 2 (africa)...
etc.

of course it's easy to check this out in a little fake dataset. But the
point I'd like to make is that if this is true, recode is not suitable for
data that are not coded in the same sequence as you want to group them in
(in my example the two neighbouring countries do not have neighboring
codes).
Don't worry, it's not true. Unlike in SPSS, in Stata you can easily recode things like "1=2 2=1" , because the whole command gets evaluated at the same time, and not from left to right.


*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* 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   |   What's new   |   Site index