Statalist The Stata Listserver

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

Re: st: RE: Data management

From   "Richard Williams" <Richard.A.Williams.5@ND.Edu>
Subject   Re: st: RE: Data management
Date   Sat, 24 Mar 2007 23:44:26 -0400

Suryadipta asked:

b. Then I am trying to replace these id-s with
replace id=3 if id==1;
replace id=5 if id==2;
replace id=8 if id==3;

But the 3rd line of the command is replacing the first set
of id-s also. I would greatly appreciate if someone can
suggest how to take care of this.

A couple of possibilities:

1.  Just reverse the order in which you are giving the commands

2.  Use the recode command, e.g.

recode id (1=3)(2=5)(3=8)

See -help recode-

[NOTE: Notre Dame's email server is acting up so I am trying gmail.
Hopefully I am not doing something horrible like sending html to the
list! ]
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
*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index