I want to use the command "strpos" to extract specific observations from a string variable. Im using the command below,
"g newvar = 1 if strpos(var1, "[1]")>0 "
The using variable "var1" looks like below
var1
0 1 2 3
3 4 0 1
I would like to create a variable that takes the value 1 if var1 consists string obs 1. Any help on this would be really appreciated.
0 Response to Using "strpos" to create new variable
Post a Comment