I am having trouble with the --replace-- command. Below is a simple
example. My intention is to make var1=9 for all observations with
var3==1.1. What is wrong with my code?
Thanks for your help,
Ben
. clear
. mata st_addobs(1)
. gen var1 = 0
. gen var2 = 1
. gen var3 = 1.1
. sum
Variable | Obs Mean Std. Dev. Min Max
-------------+--------------------------------------------------------
var1 | 1 0 . 0 0
var2 | 1 1 . 1 1
var3 | 1 1.1 . 1.1 1.1
. replace var1 = 9 if var3==1.1
(0 real changes made)
. replace var1 = 9 if var2==1
(1 real change made)
*
* 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/