Hi
I have data stored under variable name ad (str199) which looks like this
1 cawood av, kathu, kathu, northern cape
1 hanger 30, 11 lanseria airport st, lanseria airport, randburg, gauteng
12 pretoria str, kemptonpark, kempton park
I want to create 2 variables: 1 that contains the phrase that occurs after the last comma (so, "northern cape" "gauteng" "kempton park"), and variable 2 that contains the phrase that occurs after the second last comma (so, "kathu, northern cape" "randburg, guateng" "kemptonpark, kempton park")
I'm trying to use -split- or -regexm- but can't work out how to do it! Any help would be appreciated!
Thanks
Megan
I have data stored under variable name ad (str199) which looks like this
1 cawood av, kathu, kathu, northern cape
1 hanger 30, 11 lanseria airport st, lanseria airport, randburg, gauteng
12 pretoria str, kemptonpark, kempton park
I want to create 2 variables: 1 that contains the phrase that occurs after the last comma (so, "northern cape" "gauteng" "kempton park"), and variable 2 that contains the phrase that occurs after the second last comma (so, "kathu, northern cape" "randburg, guateng" "kemptonpark, kempton park")
I'm trying to use -split- or -regexm- but can't work out how to do it! Any help would be appreciated!
Thanks
Megan
Comment