Posted by
pmulonge on
Mar 06, 2012; 9:29am
URL: http://spssx-discussion.165.s1.nabble.com/Creating-a-numeric-ID-from-name-and-surnames-of-cases-tp5540350.html
I would appreciate help with the following problem in SPSS syntax.
I have a dataset where the cases only have name and surname and no numeric
ID
e.g.
DATA LIST / name(a5) surname(a5).
BEGIN DATA
Johny Smith
Rachel Cohen
Ingrid Brown
END DATA.
I also have another dataset where presumably the same names and surname
appear with the same spelling.
DATA LIST / name(a5) surname(a5).
BEGIN DATA
JOHN SMITH
PAUL BLUE
RACHEL COHEN
TONY HILLS
INGRID BROWN
END DATA.
My question is then: is there a way to merge these datasets based on a
unique identifier? We have chosen name and surname.
My solution was to concatenate the name and surname into one string var
COMPUTE NOME = CONCAT(NAME,SURNAME).
I then proceed to try and use
RECODE NOME (CONVERT) NOME1.
ALTER TYPE NOME (F10).
COMPUTE NOME1 = NUMBER(NOME,F10)
But each time it just converts it to missing values, with no numbers.
The only one that worked was
AUTORECODE VAR = NOME /INTO NOME1.
The problem with AUTORECODE is that they are numbered alphabetically
according in the dataset, so INGRID BROWN will be a different number in the
first dataset from the number assigned in the second dataset. Therefore,
there is no unique ID given based on spelling of the string.
Is there a way around this?
Thanks
=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Pancho Mulongeni,
Research Assistant
Pharmaccess Foundation,
Namibia