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]

st: AW: comparing strings

From   "Martin Weiss" <>
To   <>
Subject   st: AW: comparing strings
Date   Tue, 6 Jul 2010 18:00:38 +0200


You can -generate- an indicator variable to this effect, or -assert- the
relationship and see what happens. It may make sense to -trim()- the strings
to get rid of blanks beforehand.

inp str15(name name1)
"John Smith" "Ray Adams"
"Jane Gore" "Jane Gore"

gen byte equalnames=name==name1
list, noo ab(15)

assert name==name1


-----Ursprüngliche Nachricht-----
[] Im Auftrag von
Gesendet: Dienstag, 6. Juli 2010 17:56
Betreff: st: comparing strings


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.

Thank you
*   For searches and help try:

*   For searches and help try:

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