Statalist The Stata Listserver


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

Re: st: How to quickly replace values of a variable


From   "Svend Juul" <SJ@SOCI.AU.DK>
To   <statalist@hsphsun2.harvard.edu>
Subject   Re: st: How to quickly replace values of a variable
Date   Thu, 1 Feb 2007 09:29:03 +0100

Quang wrote:

... there is no "rule" relating the old values to the new values. 
E.g., 101 replaced by 65687; 102 by 65686; 103 by 73128 and so on. 
Thus, I can use:

recode id (101=65687) (102=65686) (103=73128) and so on

Alternatively, I can create another file containing information on the
new values of ID. Then, I match the new file and the original file.
--------------------------------------------------------------

With many values I would definitely create another file and then merge:

input permit permit2
101 65687
102 65686
103 73128
...
end
sort permit
merge permit using ...

Hope this helps
Svend
__________________________________________

Svend Juul
Institut for Folkesundhed, Afdeling for Epidemiologi
(Institute of Public Health, Department of Epidemiology)
Vennelyst Boulevard 6
DK-8000  Aarhus C, Denmark
Phone: +45 8942 6090
Home:  +45 8693 7796
Email: sj@soci.au.dk
__________________________________________ 

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