Hi everyone,
I have a string var and I would like to split that var to get the last part of the string text, say the string var has dataset as below:
name
adam smith
julia jig
beffy mark
And I want to get the last part of this dataset, which is "smith", "jig" and "mark'.
I have tried to use the command as below but it does not work:
-- egen newvar=ends(name) trim[last]
Could anyone help me to sold this issue. Sorry if this question is a basic one. I've searched on google but I cannot find the solution yet.
Thank you a lot
Kind regards
Linh
Related Posts with Split string variable
Frequency detection problemI have data about doctors and their patients. Every doctor has an ID. And one doctor could treat sev…
Coefplot dropping first interaction w/ reghdfeDear colleagues, Using coefplot after running reghdfe, interaction terms are being dropped. For ex…
Predicting DV by keeping covariates at mean+-SD and visualisationDear Statalists, This is my very first post on the forum. Here goes my problem: I want to generate…
Generating a Variable of Respondents MeansI am currently trying to generate a new variable consisting of respondents means. This new variable …
Creating a dummy variableHi there, I have a date variable formatted as 1980m1 etc. I want to create a dummy variable which is…
Subscribe to:
Post Comments (Atom)
0 Response to Split string variable
Post a Comment