Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: trouble with replace and decimals


From   Ben Zipperer <[email protected]>
To   [email protected]
Subject   st: trouble with replace and decimals
Date   Thu, 30 Oct 2008 16:10:35 -0400

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/



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