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 jabcos
william adam beg tiffy
And I want to get the last part of this dataset, which is "smith", "jig" and "jabcos" and "tiffy" and the wanted results should be:
name newname
adam smith smith
julia jig jig
beffy mark jabcos jabcos
william adam beg tiffy tiffy
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
(editted: add more example)
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 jabcos
william adam beg tiffy
And I want to get the last part of this dataset, which is "smith", "jig" and "jabcos" and "tiffy" and the wanted results should be:
name newname
adam smith smith
julia jig jig
beffy mark jabcos jabcos
william adam beg tiffy tiffy
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
(editted: add more example)
Comment