Dear Statalist,
I have a string variable "comment" stored as "strL" that contains a mix of numbers, characters and spaces .
storage display value
variable name type format label variable label
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
comment strL %9s comment
I need to extract information from it for the source of data the record comes from, one source can be "SoWMy", the other "NRI", ....etc potentially 10 different data sources. I have about 28,000 records.
I am a bit lost on which substring command I should use.
I tried "gen source1 = regexs(1) if(regexm(comment, "SoWMY"))" and got the error "invalid number, outside of allowed range" -
Any advice would be most appreciated.
Kind regards,
Amani
Related Posts with Using substring functions in Stata 16.1
Number of instruments more than number of groups in estimation resultI am a first-time user of STATA. I am trying to use system GMM to estimate a social welfare function…
Can I define the cell contents of a table (or matrix)?New here, new to Stata (v17) I'm trying to create a table to later be exported to Excel. I would li…
Reshape wide with missing observationsHello, I am trying to reshape wide the dataset below. Basically i would like the months (January th…
calculation odd ratio for interaction terms using LincomI am doing logistic regression to look at several predictors for a certain outcome. I checked the in…
Cox regression hazard ratio interpretation----------------------- Code: * Example generated by -dataex-. For more info, type help dataex clea…
Subscribe to:
Post Comments (Atom)
0 Response to Using substring functions in Stata 16.1
Post a Comment