Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: replacing values of a variable


From   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: replacing values of a variable
Date   Sat, 9 Mar 2013 11:49:06 +0000

It's legal. If it doesn't do what you expect, check for leading, trailing or repeated internal spaces and consistency in using lower and upper case. Fix problems with -trim()-, -itrim()- and -lower()-.

Nick

On 9 Mar 2013, at 10:27, James Bernard <[email protected]> wrote:

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?
*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index