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 on April 23, and its replacement, is already up and running.

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

RE: st: comparing strings

From   "Nick Cox" <>
To   <>
Subject   RE: st: comparing strings
Date   Wed, 7 Jul 2010 10:41:14 +0100

You could, but with just two variables 

gen newvar = name != name1 

is much more direct. 


Abhimanyu Arora

You can use egen newvar=diff(name name1)

On Tue, Jul 6, 2010 at 5:55 PM,  <> wrote:

> I have two variables name and name1 that contain strings. How can I compare
> whether the strings are the same or not?
> For example in the same row  name can be "John Smith" and name1 can be "Ray
> Adams" so they are not the same. Or there can be another row that both name
> and name1 are "Jane Gore" so they are the same.

*   For searches and help try:

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