Statalist


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

st: Re: trouble with replace and decimals


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: Re: trouble with replace and decimals
Date   Thu, 30 Oct 2008 21:02:26 +0100

Line for the server


http://www.stata.com/support/faqs/data/float.html



HTH
Martin _______________________ ----- Original Message ----- From: "Ben Zipperer" <[email protected]>
To: <[email protected]>
Sent: Thursday, October 30, 2008 9:00 PM
Subject: st: trouble with replace and decimals


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/


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