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
Adding linear time trends (dropped)Dear Statalist Users, I have the following data. This dataset is at city level. Plate=unique ident…
How to add fixed effect in sureg Stata?Hi everyone, I have a question about how to add fixed effect in sureg and I wonder if anyone of you…
Fixed effect- three identifier variables and result interpretationI have panel dataset where each observation is identified by three variables ( server#, Motherboard_…
Variance Covariance Matrix of Sureg in StataHi everyone, I have a question about how to display the variance-covariance matrix for the residual…
collect: rows and columns' name changed?I am trying to learn Stata's -collect- and to manipulate tables. I find the manipulating part hard. …
Subscribe to:
Post Comments (Atom)
0 Response to Using substring functions in Stata 16.1
Post a Comment