Show less
You need a way to determine whether a tentative new name has already been established for another person.
Show us the code (as a complete data step, or complete proc sql) that you are currently using - USING THE
OR
ICONS. That is essential to developing code to detect duplicates.
data emp1; set emp;
length name $70.;
middle_name2=substr(middle_name,1,1);
name_MI=trim(last_name)||", "||trim(first_name)||" "||trim(middle_name2);
first_name_i=scan(first_name,1);
name=trim(last_name)||", "||trim(first_name_i);
run;
I have a base data that was set up already as (Lastname, Firstname middle initial like Smart, Johnson L).
Don't bother making the NAME unique. Create an ID variable that is unique.
Something like:
data want;
set have;
id+1;
new_name = catx(', ',last_name,catx(' ',first_name,middle_initial));
run;
Then use their ID when combining the names with other data you have about them.
@Astounding's suggestion is good for the current situation, assuming no department currently has two people with the same name.
But people change departments - and much less frequently they change names. Either the identifier will remain fixed, but lose informational value (so why use name & dept to begin with?) - or it will be modified to follow the employee's changes, requiring a table of links between old and new identifiers.
There will be blood.
@mkeintz wrote:
@Astounding's suggestion is good for the current situation, assuming no department currently has two people with the same name.
But people change departments - and much less frequently they change names. Either the identifier will remain fixed, but lose informational value (so why use name & dept to begin with?) - or it will be modified to follow the employee's changes, requiring a table of links between old and new identifiers.
There will be blood.
Sounds like you may have bitten by the same things that I have. Including the "new database implementation will use new identifiers" headache.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.