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
Remove gaps between the y-axis first or last ticks and horizontal frames of a box plotHi Stata box plot experts; I am sketching a box plot using Stata. These are my codes for y-axis lab…
Probit model with fixed effectsDear all, I am estimating a probit model with individual-level data on sickness and district-level …
Bar Graph with multiples variables and categoriesHi, everyone! I need to perform a bar graph with 2 variables containing 4 categories each. The 2 var…
calculating a formula in stataHello everyone I have a sample of 100 rnormal() in stata, am going to calculate this formula in stat…
Problems with Panel Data AnalysisHello everyone, I'm dealing with panel data analysis and still confused about few things I have a t…
Subscribe to:
Post Comments (Atom)
0 Response to Using substring functions in Stata 16.1
Post a Comment