I have the following variable "location" which contains the city and state name. I need to split it into a new variable which contains only the city name since I already have the state names.

I have used the following command to split the data:
. split location, parse(,) generate(temp)
Unfortunately, some of the data points such as the 1st one have additional data (18th and vine) which are not required but result in the split data mismatch (I require Kansas City to be in the first column)

How can I split the data so that I can extract only the city name?
Thanks
I have used the following command to split the data:
. split location, parse(,) generate(temp)
Unfortunately, some of the data points such as the 1st one have additional data (18th and vine) which are not required but result in the split data mismatch (I require Kansas City to be in the first column)
How can I split the data so that I can extract only the city name?
Thanks
Comment