Using SAS 9.4 What is the best method for splitting patient name into first name and last name if some of the patients are a "jr" or "IV"? The patient list does not have any commas to separate the data, it is written "John Smith" "John Smith Jr" "Jane Smith" "Jane Smith Sr" "John Smith IV" "John Smith III" etc. My code DATA want; SET have; CALL SCAN(PATIENT_NAME, -1, POSITION, LENGTH); FIRST_NAME = SUBSTR(PATIENT_NAME, 1, POSITION-1); LAST_NAME = SCAN(PATIENT_NAME, -1, ' '); KEEP LAST_NAME FIRST_NAME DOB GENDER; FORMAT FIRST_NAME LAST_NAME $100.; RUN; The problem is this code leaves the "Jr" "Sr" "IV" in the newly created last_name variable Thanks for any help
... View more