I have a column with names and middles names separated by space. Is there a command that will let me put everything after space into a new column? (ie first names and middle names each in their own columns)
I am using SPSS.
Thanks!
Assuming the variable to split is called Name, try:
string first middle (a50).
compute #x = char.index(Name, " ") > 0.
do if #x = 1.
compute first = char.substr(Name, 1, char.index(Name, " ")).
compute middle = char.substr(Name, char.index(Name, " ")).
else.
compute first = Name.
end if.
exe.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With