Hi all,
one short question:
I want to check if - as in the title - a string variable (var1) contains characters (or the exact realization) from another string variable (var2).
Example:
thus something like
gen var3=0
replace var3=1 if strpos(var1,"var2")
which of course does not work because s2 in strpos is not supposed to be a variable but a certain word.
The variable thing makes it complicated to me.
Thanks in advance
Tim
one short question:
I want to check if - as in the title - a string variable (var1) contains characters (or the exact realization) from another string variable (var2).
Example:
var1 | var2 | var3 |
blabla AAA blabla | AAA | 1 |
blabla blabla | AAA | 0 |
bla bla | AAA | 0 |
bla bla bla | BBB | 0 |
bla bla BBB | BBB | 1 |
bla BBB blabla | BBB | 1 |
CCC bla bla | CCC | 1 |
gen var3=0
replace var3=1 if strpos(var1,"var2")
which of course does not work because s2 in strpos is not supposed to be a variable but a certain word.
The variable thing makes it complicated to me.
Thanks in advance
Tim
Comment