Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: condensing varlist non-categorical contents to a newvar


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: condensing varlist non-categorical contents to a newvar
Date   Thu, 6 Mar 2008 22:02:30 -0000

As far as I understand this you seem to need the -replace- command. But 
create a safe copy of the original first. However, -recode- does apply
more
generally than the examples imply. 

b. water

stata 8.2,

i have a variable named injurytype

injurytype
.
.
type II
.
.
none sig
.
.
type III
type III
.
type III and IV
.
.
.
type IV
.
.

i want to reclassify contents of variable injurytype in a new variable
such that the missing values and none sig will be reported as minimal,
type II remain as type II, type III remain as type III, but type III and
IV to be combined with type IV and be reported as major. that is the new
variable (let's call it newvar) would look something like this:

newvar
minimal
minimal
type II
minimal
minimal
minimal
minimal
minimal
type III
type III
minimal
type IV
minimal
minimal
minimal
type IV
minimal
minimal

i tried to look up [R] gen and egen but could not see any that would
help. [R] recode seems to be closest but only applies to categorical
variables. would appreciate advice and help on how to achieve what i
wanted to do.

regards,
bw


_________________________________________________________________
Connect and share in new ways with Windows Live.
http://www.windowslive.com/share.html?ocid=TXT_TAGHM_Wave2_sharelife_012
008
*
*   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/

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