I inherited an xlsx file with one particularly irksome field -> guardians
data I have:
guardians
Smith, Joe Smith, Jane
Jones, Bill Jones, Pat
Wells, Donna
I want to create a first and last name for each person. This is the code I used:
data pt3;
set pt2;
Lguard_1=scan(guardians,1,',');
Fguard_1=scan(guardians,2,' ');
Lguard_2=scan(guardians,-2,' ');
Fguard_2=scan(guardians,-1,' ');
run;
data I now have:
Lguard_1 Fguard_1 Lguard_2 Fguard_2
Smith Joe Smith, Jane
Jones Bill Jones, Pat
Wells Donna Wells, Donna
2 things: 1) i need to get rid of the pesky comma in Lguard_2 and 2) I don't want to repeat a single parent/guardian name such as obs 3.
... View more