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
Additional variables in second stage of control function approachDear all, I am estimating a reduced form CRE tobit as the first stage model in a control function a…
Check that string variable equals label of encoded variableHi, I am merging several files and I would like to verify that I have done it properly. If I made a…
import excel for few defined rows up to the end of spreadsheet for columnsHi, I am trying to import an excel spreadsheet for few defined rows up to the end of spreadsheet fo…
Mipolate backward imputation for missing valuesHi, I need help with imputing missing values for my panel data for 100+ countries for 15 years (from…
Stacked Bar Chart or other Chart that can show change of groups/conditions through time in panel dataDear Stata Users, I have a panel data file that follow children every two years for a total of 4 wa…
Subscribe to:
Post Comments (Atom)
0 Response to Using "strpos" to create new variable
Post a Comment