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.
Related Posts with Using "strpos" to create new variable
regression loop !Dear Colleagues I have daily stock returns and market return for 100 firms and for a number of year…
Odds ratios and Interaction effects InterpretationHi All, I have having some trouble interpreting some interaction effects of some panel data ordinal…
stata commandI have several observations (individuals) with each belong to a household (so each has a household I…
Addtions of observations with conditionsHello everybody, I have a big dataset to manage and I'd like to reduce it. To do so, I want to add …
New program -ineqdecgini- (Gini coefficient and its subgroup decomposition) now available on SSC-ineq …
Subscribe to:
Post Comments (Atom)
0 Response to Using "strpos" to create new variable
Post a Comment