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