namejob1 is a string variable that has individual names and their job title
namejob1
Tina Lee Firefighterjob2 is a string variable has individual job titles extracted from namejob1
Border John Doe Patrol
Trevor Secretary Jones
Legislative Aide Samuel Adams-Perez
Jane Smith Highway Police
job2
FirefighterI have over 1000 unique values (i.e., job titles) in job2 and the number of unique observations in namejob1 is over a million. namejob1 is messy overall with the job titles sitting in different places (i.e., beginning, middle, end, etc.) and some are even broken up (see, Border John Doe Patrol).
Border Patrol
Secretary
Legislative Aide
Highway Police
I've been trying to figure out how to subtract job2 from namejob1 into a new variable so I get the desired_name3 (listed below). desired_name3 would be a new string variable that just has individual names (namejob1 - job2)
desired_name3
Tina LeeAny thoughts? I'm trawled the webs and Stack Overflow and I'm not finding anything helpful in subtracting string variables using another string variable as the substring (most are solutions for fixed substrings, like "vs." or parsing using symbols or spaces).
John Doe
Trevor Jones
Samuel Adams-Perez
Jane Smith
Thanks so much.
0 Response to "Subtracting" one string variable from another string variable
Post a Comment