I am trying to match two different data sets via the variable name. The problem that occurs is that some of the names in data set 1 end with a letter "s", e.g. SMEDSTORPS or TOSTERUPS while in data set 2 the S at the end is missing.
Data set 1:
Code:
name
SMEDSTORPS
STIBY
TOSTERUPS
Data set 2:
Code:
name
SMEDSTORP
STIBY
TOSTERUP
When I use the following
Code:
replace name = cond(substr(name,-1,.)=="S",subinstr(name,"S","",.),name)
not only the S at the end is removed but also all other S in the name.
Code:
name
MEDTORP
STIBY
TOTERUP
Does someone have an idea how to fix this problem?
Thanks in advance!