Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

st: replacing values of a variable


From   James Bernard <jamesstatalist@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: replacing values of a variable
Date   Sat, 9 Mar 2013 18:27:46 +0800

Hi folks,

I am trying to copy values of a string variable into another one if a
condition is met. I keep getting "0 real changes made"

var 1                   var2
---------               ---------
jan-2000            jan-2000
march-2000       same year
june-1999          june-1999

replace var2=var1 if var2=="same year"

what is wrong with this code?

Thanks in advance

James
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index