I have a name list:
data nurse_0;
input nms $28. ;
cards;
Abcd Efgxxeg, BSN, RN
Dudng Nioll, RN, CCM
Doujh Keeloou, RN
Hardlop Aceed RN BSN
Jnmjkl Tuutt, BSN RN, CCM
Kommmbbey Maxxt, RN, CM
;
run;
and I want split the first name and rest of the names w/o any change into 2 colums, first_nm and last_nm:
first_nm last_nm
Abcd Efgxxeg, BSN, RN
Dudng Nioll, RN, CCM
Doujh Keeloou, RN
Hardlop Aceed RN BSN
Jnmjkl Tuutt, BSN RN, CCM
Kommmbbey Maxxt, RN, CM
data want;
set nurse_0;
first_nm = scan(nms, 1);
last_nm = substr(nms, find(nms, ' ') + 1);
drop nms;
run;
Result:
first_nm last_nm
Abcd Efgxxeg, BSN, RN
Dudng Nioll, RN, CCM
Doujh Keeloou, RN
Hardlop Aceed RN BSN
Jnmjkl Tuutt, BSN RN, CCM
Kommmbbey Maxxt, RN, CM