Creating unique variable from two variables

classic Classic list List threaded Threaded
16 messages Options
Reply | Threaded
Open this post in threaded view
|

Creating unique variable from two variables

Michael Pullmann
Hi all,
I have a set of data received from submissions by various projects (ProjID).
The ProjIDs were assigned by us, and therefore they are unique. However, the
projects assign their own worker ID (WrkrID). Therefore, many of the worker
IDs are duplicates (but not all--some project assigned some fairly bizarre
IDs). All IDs are numeric. I'd like to create a third variable that uniquely
identifies workers, regardless of Project ID, for importing into HLM. My
dataset currently looks like this:

ProjID    WrkrID
101       1
101       2
101       3
101       4
102       1
102       3
102       4
102       5
102       9
.         .
.         .
.         .

Thanks in advance for your help!

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: Creating unique variable from two variables

Bruce Weaver
Administrator
Something like:

COMPUTE NewID = ProjID*10**3 +  WrkrID.

Depending on how many digits WrkrID can have, you might need/want to adjust that 10**3 up or down.


Michael Pullmann wrote
Hi all,
I have a set of data received from submissions by various projects (ProjID).
The ProjIDs were assigned by us, and therefore they are unique. However, the
projects assign their own worker ID (WrkrID). Therefore, many of the worker
IDs are duplicates (but not all--some project assigned some fairly bizarre
IDs). All IDs are numeric. I'd like to create a third variable that uniquely
identifies workers, regardless of Project ID, for importing into HLM. My
dataset currently looks like this:

ProjID    WrkrID
101       1
101       2
101       3
101       4
102       1
102       3
102       4
102       5
102       9
.         .
.         .
.         .

Thanks in advance for your help!

=====================
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
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Re: Creating unique variable from two variables

kwame woei
In reply to this post by Michael Pullmann
You can only create the third variable by hand. No way you can distinguish -1 from 102-  from 102-3 without a unique key.

Op 18 mrt. 2013 om 20:09 heeft "Mike Pullmann" <[hidden email]> het volgende geschreven:

> Hi all,
> I have a set of data received from submissions by various projects (ProjID).
> The ProjIDs were assigned by us, and therefore they are unique. However, the
> projects assign their own worker ID (WrkrID). Therefore, many of the worker
> IDs are duplicates (but not all--some project assigned some fairly bizarre
> IDs). All IDs are numeric. I'd like to create a third variable that uniquely
> identifies workers, regardless of Project ID, for importing into HLM. My
> dataset currently looks like this:
>
> ProjID    WrkrID
> 101       1
> 101       2
> 101       3
> 101
> 102       1
> 102       3
> 102       4
> 102       5
> 102       9
> .
> .         .
> .         .
>
> Thanks in advance for your help!
>
> =====================
> To manage your subscription to SPSSX-L, send a message t
> [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

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: Creating unique variable from two variables

kwame woei
In reply to this post by Bruce Weaver
But how do you solve the problem that Worker 1 in Project 1 is not the same worker as Worker 1 in project 2? With the below you have a unique id, but you can't match it to the workers.

Op 18 mrt. 2013 om 20:20 heeft "Bruce Weaver" <[hidden email]> het volgende geschreven:

> Something like:
>
> COMPUTE NewID = ProjID*10**3 +  WrkrID.
>
> Depending on how many digits WrkrID can have, you might need/want to adjust
> that 10**3 up or down.
>
>
>
> Michael Pullmann wrote
>> Hi all,
>> I have a set of data received from submissions by various projects
>> (ProjID).
>> The ProjIDs were assigned by us, and therefore they are unique. However,
>> the
>> projects assign their own worker ID (WrkrID). Therefore, many of the
>> worker
>> IDs are duplicates (but not all--some project assigned some fairly bizarre
>> IDs). All IDs are numeric. I'd like to create a third variable that
>> uniquely
>> identifies workers, regardless of Project ID, for importing into HLM. My
>> dataset currently looks like thi
>> ProjID    WrkrID
>> 101       1
>> 101       2
>> 101       3
>> 101       4
>> 102       1
>> 102       3
>> 102       4
>> 102       5
>> 102       9
>> .         .
>> .         .
>> .         .
>>
>> Thanks in advance for your help!
>>
>> =====================
>> To manage your subscription to SPSSX-L, send a message to
>
>> LISTSERV@.UGA
>
>> (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
>
>
>
>
>
> -----
> --
> Bruce Weaver
> [hidden email]
> http://sites.google.com/a/lakeheadu.ca/bweaver/
>
> "When all else fails, RTFM."
>
> NOTE: My Hotmail account is not monitored regularly.
> To send me an e-mail, please use the address shown above.
>
> --
> View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Creating-unique-variable-from-two-variables-tp5718821p5718822.html
> Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>
> =====================
> 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

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: Creating unique variable from two variables

David Marso
Administrator
Before even bothering to torture my brain for an additional 30 seconds with this I will request Michael to more carefully clarify the question.
Show example of real input and desired output (particularly for the 'fairly bizarre IDs').
Also, please peruse the recently bumped thread "Tips on Posting questions to the SPSS list" for insights into best practices for eliciting responses to your future questions.

kwame woei wrote
But how do you solve the problem that Worker 1 in Project 1 is not the same worker as Worker 1 in project 2? With the below you have a unique id, but you can't match it to the workers.

Op 18 mrt. 2013 om 20:20 heeft "Bruce Weaver" <[hidden email]> het volgende geschreven:

> Something like:
>
> COMPUTE NewID = ProjID*10**3 +  WrkrID.
>
> Depending on how many digits WrkrID can have, you might need/want to adjust
> that 10**3 up or down.
>
>
>
> Michael Pullmann wrote
>> Hi all,
>> I have a set of data received from submissions by various projects
>> (ProjID).
>> The ProjIDs were assigned by us, and therefore they are unique. However,
>> the
>> projects assign their own worker ID (WrkrID). Therefore, many of the
>> worker
>> IDs are duplicates (but not all--some project assigned some fairly bizarre
>> IDs). All IDs are numeric. I'd like to create a third variable that
>> uniquely
>> identifies workers, regardless of Project ID, for importing into HLM. My
>> dataset currently looks like thi
>> ProjID    WrkrID
>> 101       1
>> 101       2
>> 101       3
>> 101       4
>> 102       1
>> 102       3
>> 102       4
>> 102       5
>> 102       9
>> .         .
>> .         .
>> .         .
>>
>> Thanks in advance for your help!
>>
>> =====================
>> To manage your subscription to SPSSX-L, send a message to
>
>> LISTSERV@.UGA
>
>> (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
>
>
>
>
>
> -----
> --
> Bruce Weaver
> [hidden email]
> http://sites.google.com/a/lakeheadu.ca/bweaver/
>
> "When all else fails, RTFM."
>
> NOTE: My Hotmail account is not monitored regularly.
> To send me an e-mail, please use the address shown above.
>
> --
> View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Creating-unique-variable-from-two-variables-tp5718821p5718822.html
> Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>
> =====================
> 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

=====================
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
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: Creating unique variable from two variables

Bruce Weaver
Administrator
In reply to this post by kwame woei
I don't understand the question.  Here are the NewID values for the data that were shown.

ProjID WrkrID    NewID
 
   101      1   101001   <-- ID for Project 101, Worker 1
   101      2   101002
   101      3   101003
   101      4   101004
   102      1   102001   <-- ID for Project 102, Worker 1
   102      3   102003
   102      4   102004
   102      5   102005
   102      9   102009


kwame woei wrote
But how do you solve the problem that Worker 1 in Project 1 is not the same worker as Worker 1 in project 2? With the below you have a unique id, but you can't match it to the workers.

Op 18 mrt. 2013 om 20:20 heeft "Bruce Weaver" <[hidden email]> het volgende geschreven:

> Something like:
>
> COMPUTE NewID = ProjID*10**3 +  WrkrID.
>
> Depending on how many digits WrkrID can have, you might need/want to adjust
> that 10**3 up or down.
>
>
>
> Michael Pullmann wrote
>> Hi all,
>> I have a set of data received from submissions by various projects
>> (ProjID).
>> The ProjIDs were assigned by us, and therefore they are unique. However,
>> the
>> projects assign their own worker ID (WrkrID). Therefore, many of the
>> worker
>> IDs are duplicates (but not all--some project assigned some fairly bizarre
>> IDs). All IDs are numeric. I'd like to create a third variable that
>> uniquely
>> identifies workers, regardless of Project ID, for importing into HLM. My
>> dataset currently looks like thi
>> ProjID    WrkrID
>> 101       1
>> 101       2
>> 101       3
>> 101       4
>> 102       1
>> 102       3
>> 102       4
>> 102       5
>> 102       9
>> .         .
>> .         .
>> .         .
>>
>> Thanks in advance for your help!
>>
>> =====================
>> To manage your subscription to SPSSX-L, send a message to
>
>> LISTSERV@.UGA
>
>> (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
>
>
>
>
>
> -----
> --
> Bruce Weaver
> [hidden email]
> http://sites.google.com/a/lakeheadu.ca/bweaver/
>
> "When all else fails, RTFM."
>
> NOTE: My Hotmail account is not monitored regularly.
> To send me an e-mail, please use the address shown above.
>
> --
> View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Creating-unique-variable-from-two-variables-tp5718821p5718822.html
> Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>
> =====================
> 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

=====================
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
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Re: Creating unique variable from two variables

kwame woei
Worker 1 in Project 1 is not the same person as Worker 1 in project 2 (duplicate and bizarre WrkrID's)

Op 18 mrt. 2013 om 20:56 heeft "Bruce Weaver" <[hidden email]> het volgende geschreven:

> I don't understand the question.  Here are the NewID values for the data that
> were shown.
>
> ProjID WrkrID    NewID
>
>   101      1   101001   <-- ID for Project 101, Worker 1
>   101      2   101002
>   101      3   101003
>   101      4   101004
>   102      1   102001   <-- ID for Project 102, Worker 1
>   102      3   102003
>   102      4   102004
>   102      5   102005
>   102      9   102009
>
>
>
> kwame woei wrote
>> But how do you solve the problem that Worker 1 in Project 1 is not the
>> same worker as Worker 1 in project 2? With the below you have a unique id,
>> but you can't match it to the workers.
>>
>> Op 18 mrt. 2013 om 20:20 heeft "Bruce Weaver" &lt;
>
>> bruce.weaver@
>
>> &gt; het volgende geschreven:
>>
>>> Something like:
>>>
>>> COMPUTE NewID = ProjID*10**3 +  WrkrID.
>>>
>>> Depending on how many digits WrkrID can have, you might need/want to
>>> adjust
>>> that 10**3 up or down.
>>>
>>>
>>>
>>> Michael Pullmann wrote
>>>> Hi all,
>>>> I have a set of data received from submissions by various projects
>>>> (ProjID).
>>>> The ProjIDs were assigned by us, and therefore they are unique. However,
>>>> the
>>>> projects assign their own worker ID (WrkrID). Therefore, many of the
>>>> worker
>>>> IDs are duplicates (but not all--some project assigned some fairly
>>>> bizarre
>>>> IDs). All IDs are numeric. I'd like to create a third variable that
>>>> uniquely
>>>> identifies workers, regardless of Project ID, for importing into HLM. My
>>>> dataset currently looks like thi
>>>> ProjID    WrkrID
>>>> 101       1
>>>> 101       2
>>>> 101       3
>>>> 101       4
>>>> 102       1
>>>> 102       3
>>>> 102       4
>>>> 102       5
>>>> 102       9
>>>> .         .
>>>> .         .
>>>> .         .
>>>>
>>>> Thanks in advance for your help!
>>>>
>>>> =====================
>>>> To manage your subscription to SPSSX-L, send a message to
>>>
>>>> LISTSERV@.UGA
>>>
>>>> (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
>>>
>>>
>>>
>>>
>>>
>>> -----
>>> --
>>> Bruce Weaver
>>>
>
>> bweaver@
>
>>> http://sites.google.com/a/lakeheadu.ca/bweaver/
>>>
>>> "When all else fails, RTFM."
>>>
>>> NOTE: My Hotmail account is not monitored regularly.
>>> To send me an e-mail, please use the address shown above.
>>>
>>> --
>>> View this message in context:
>>> http://spssx-discussion.1045642.n5.nabble.com/Creating-unique-variable-from-two-variables-tp5718821p5718822.html
>>> Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>>>
>>> =====================
>>> To manage your subscription to SPSSX-L, send a message to
>>>
>
>> LISTSERV@.UGA
>
>> (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
>>
>> =====================
>> To manage your subscription to SPSSX-L, send a message to
>
>> LISTSERV@.UGA
>
>> (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
>
>
>
>
>
> -----
> --
> Bruce Weaver
> [hidden email]
> http://sites.google.com/a/lakeheadu.ca/bweaver/
>
> "When all else fails, RTFM."
>
> NOTE: My Hotmail account is not monitored regularly.
> To send me an e-mail, please use the address shown above.
>
> --
> View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Creating-unique-variable-from-two-variables-tp5718821p5718829.html
> Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>
> =====================
> 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

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: Creating unique variable from two variables

Bruce Weaver
Administrator
The project numbers are actually 101 and 102, not 1 and 2.  And notice that Worker 1 for Project 101 and Worker 1 for Project 102 do not have the same values for NewID.

Worker 1 in Project 101 has NewID = 101001.
Worker 1 in Project 102 has NewID = 102001.


kwame woei wrote
Worker 1 in Project 1 is not the same person as Worker 1 in project 2 (duplicate and bizarre WrkrID's)

Op 18 mrt. 2013 om 20:56 heeft "Bruce Weaver" <[hidden email]> het volgende geschreven:

> I don't understand the question.  Here are the NewID values for the data that
> were shown.
>
> ProjID WrkrID    NewID
>
>   101      1   101001   <-- ID for Project 101, Worker 1
>   101      2   101002
>   101      3   101003
>   101      4   101004
>   102      1   102001   <-- ID for Project 102, Worker 1
>   102      3   102003
>   102      4   102004
>   102      5   102005
>   102      9   102009
>
>
>
> kwame woei wrote
>> But how do you solve the problem that Worker 1 in Project 1 is not the
>> same worker as Worker 1 in project 2? With the below you have a unique id,
>> but you can't match it to the workers.
>>
>> Op 18 mrt. 2013 om 20:20 heeft "Bruce Weaver" <
>
>> bruce.weaver@
>
>> > het volgende geschreven:
>>
>>> Something like:
>>>
>>> COMPUTE NewID = ProjID*10**3 +  WrkrID.
>>>
>>> Depending on how many digits WrkrID can have, you might need/want to
>>> adjust
>>> that 10**3 up or down.
>>>
>>>
>>>
>>> Michael Pullmann wrote
>>>> Hi all,
>>>> I have a set of data received from submissions by various projects
>>>> (ProjID).
>>>> The ProjIDs were assigned by us, and therefore they are unique. However,
>>>> the
>>>> projects assign their own worker ID (WrkrID). Therefore, many of the
>>>> worker
>>>> IDs are duplicates (but not all--some project assigned some fairly
>>>> bizarre
>>>> IDs). All IDs are numeric. I'd like to create a third variable that
>>>> uniquely
>>>> identifies workers, regardless of Project ID, for importing into HLM. My
>>>> dataset currently looks like thi
>>>> ProjID    WrkrID
>>>> 101       1
>>>> 101       2
>>>> 101       3
>>>> 101       4
>>>> 102       1
>>>> 102       3
>>>> 102       4
>>>> 102       5
>>>> 102       9
>>>> .         .
>>>> .         .
>>>> .         .
>>>>
>>>> Thanks in advance for your help!
>>>>
>>>> =====================
>>>> To manage your subscription to SPSSX-L, send a message to
>>>
>>>> LISTSERV@.UGA
>>>
>>>> (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
>>>
>>>
>>>
>>>
>>>
>>> -----
>>> --
>>> Bruce Weaver
>>>
>
>> bweaver@
>
>>> http://sites.google.com/a/lakeheadu.ca/bweaver/
>>>
>>> "When all else fails, RTFM."
>>>
>>> NOTE: My Hotmail account is not monitored regularly.
>>> To send me an e-mail, please use the address shown above.
>>>
>>> --
>>> View this message in context:
>>> http://spssx-discussion.1045642.n5.nabble.com/Creating-unique-variable-from-two-variables-tp5718821p5718822.html
>>> Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>>>
>>> =====================
>>> To manage your subscription to SPSSX-L, send a message to
>>>
>
>> LISTSERV@.UGA
>
>> (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
>>
>> =====================
>> To manage your subscription to SPSSX-L, send a message to
>
>> LISTSERV@.UGA
>
>> (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
>
>
>
>
>
> -----
> --
> Bruce Weaver
> [hidden email]
> http://sites.google.com/a/lakeheadu.ca/bweaver/
>
> "When all else fails, RTFM."
>
> NOTE: My Hotmail account is not monitored regularly.
> To send me an e-mail, please use the address shown above.
>
> --
> View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Creating-unique-variable-from-two-variables-tp5718821p5718829.html
> Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>
> =====================
> 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

=====================
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
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Re: Creating unique variable from two variables

kwame woei
You are correct.

What I am saying is:

ProjID  wrkrID NAMEofWorker
101.      1.        Smith
102.      1.        Jones

As Worker 1 in project 101 is not the same person as Worker 1 in project 102 it is pointless to create a new variable with unique values.
Hence my originale question:

"But how do you solve the problem that Worker 1 in Project 1 is not the
same worker as Worker 1 in project 2? With the below [= your code] you have a unique
id,
but you can't match it to the workers"



Op 18 mrt. 2013 om 21:43 heeft "Bruce Weaver" <[hidden email]> het volgende geschreven:

> The project numbers are actually 101 and 102, not 1 and 2.  And notice that
> Worker 1 for Project 101 and Worker 1 for Project 102 do *not* have the same
> values for NewID.
>
> Worker 1 in Project 101 has NewID = *101*001.
> Worker 1 in Project 102 has NewID = *102*001.
>
>
>
> kwame woei wrote
>> Worker 1 in Project 1 is not the same person as Worker 1 in project 2
>> (duplicate and bizarre WrkrID's)
>>
>> Op 18 mrt. 2013 om 20:56 heeft "Bruce Weaver" &lt;
>
>> bruce.weaver@
>
>> &gt; het volgende geschreven:
>>
>>> I don't understand the question.  Here are the NewID values for the data
>>> that
>>> were shown.
>>>
>>> ProjID WrkrID    NewID
>>>
>>>  101      1   101001   <-- ID for Project 101, Worker 1
>>>  101      2   101002
>>>  101      3   101003
>>>  101      4   101004
>>>  102      1   102001   <-- ID for Project 102, Worker 1
>>>  102      3   102003
>>>  102      4   102004
>>>  102      5   102005
>>>  102      9   102009
>>>
>>>
>>>
>>> kwame woei wrote
>>>> But how do you solve the problem that Worker 1 in Project 1 is not the
>>>> same worker as Worker 1 in project 2? With the below you have a unique
>>>> id,
>>>> but you can't match it to the workers.
>>>>
>>>> Op 18 mrt. 2013 om 20:20 heeft "Bruce Weaver" &lt;
>>>
>>>> bruce.weaver@
>>>
>>>> &gt; het volgende geschreven:
>>>>
>>>>> Something like:
>>>>>
>>>>> COMPUTE NewID = ProjID*10**3 +  WrkrID.
>>>>>
>>>>> Depending on how many digits WrkrID can have, you might need/want to
>>>>> adjust
>>>>> that 10**3 up or down.
>>>>>
>>>>>
>>>>>
>>>>> Michael Pullmann wrote
>>>>>> Hi all,
>>>>>> I have a set of data received from submissions by various projects
>>>>>> (ProjID).
>>>>>> The ProjIDs were assigned by us, and therefore they are unique.
>>>>>> However,
>>>>>> the
>>>>>> projects assign their own worker ID (WrkrID). Therefore, many of the
>>>>>> worker
>>>>>> IDs are duplicates (but not all--some project assigned some fairly
>>>>>> bizarre
>>>>>> IDs). All IDs are numeric. I'd like to create a third variable that
>>>>>> uniquely
>>>>>> identifies workers, regardless of Project ID, for importing into HLM.
>>>>>> My
>>>>>> dataset currently looks like thi
>>>>>> ProjID    WrkrID
>>>>>> 101       1
>>>>>> 101       2
>>>>>> 101       3
>>>>>> 101       4
>>>>>> 102       1
>>>>>> 102       3
>>>>>> 102       4
>>>>>> 102       5
>>>>>> 102       9
>>>>>> .         .
>>>>>> .         .
>>>>>> .         .
>>>>>>
>>>>>> Thanks in advance for your help!
>>>>>>
>>>>>> =====================
>>>>>> To manage your subscription to SPSSX-L, send a message to
>>>>>
>>>>>> LISTSERV@.UGA
>>>>>
>>>>>> (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
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> -----
>>>>> --
>>>>> Bruce Weaver
>>>>>
>>>
>>>> bweaver@
>>>
>>>>> http://sites.google.com/a/lakeheadu.ca/bweaver/
>>>>>
>>>>> "When all else fails, RTFM."
>>>>>
>>>>> NOTE: My Hotmail account is not monitored regularly.
>>>>> To send me an e-mail, please use the address shown above.
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>> http://spssx-discussion.1045642.n5.nabble.com/Creating-unique-variable-from-two-variables-tp5718821p5718822.html
>>>>> Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>>>>>
>>>>> =====================
>>>>> To manage your subscription to SPSSX-L, send a message to
>>>>>
>>>
>>>> LISTSERV@.UGA
>>>
>>>> (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
>>>>
>>>> =====================
>>>> To manage your subscription to SPSSX-L, send a message to
>>>
>>>> LISTSERV@.UGA
>>>
>>>> (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
>>>
>>>
>>>
>>>
>>>
>>> -----
>>> --
>>> Bruce Weaver
>>>
>
>> bweaver@
>
>>> http://sites.google.com/a/lakeheadu.ca/bweaver/
>>>
>>> "When all else fails, RTFM."
>>>
>>> NOTE: My Hotmail account is not monitored regularly.
>>> To send me an e-mail, please use the address shown above.
>>>
>>> --
>>> View this message in context:
>>> http://spssx-discussion.1045642.n5.nabble.com/Creating-unique-variable-from-two-variables-tp5718821p5718829.html
>>> Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>>>
>>> =====================
>>> To manage your subscription to SPSSX-L, send a message to
>>>
>
>> LISTSERV@.UGA
>
>> (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
>>
>> =====================
>> To manage your subscription to SPSSX-L, send a message to
>
>> LISTSERV@.UGA
>
>> (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
>
>
>
>
>
> -----
> --
> Bruce Weaver
> [hidden email]
> http://sites.google.com/a/lakeheadu.ca/bweaver/
>
> "When all else fails, RTFM."
>
> NOTE: My Hotmail account is not monitored regularly.
> To send me an e-mail, please use the address shown above.
>
> --
> View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Creating-unique-variable-from-two-variables-tp5718821p5718835.html
> Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>
> =====================
> 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

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: Creating unique variable from two variables

Bruce Weaver
Administrator
Did you miss this sentence in the original post?

"I'd like to create a third variable that uniquely identifies workers, regardless of Project ID, for importing into HLM."

The OP does not want to link your Smith and Jones.  Rather, he wants them each to have a unique ID.  


kwame woei wrote
You are correct.

What I am saying is:

ProjID  wrkrID NAMEofWorker
101.      1.        Smith
102.      1.        Jones

As Worker 1 in project 101 is not the same person as Worker 1 in project 102 it is pointless to create a new variable with unique values.
Hence my originale question:

"But how do you solve the problem that Worker 1 in Project 1 is not the
same worker as Worker 1 in project 2? With the below [= your code] you have a unique
id,
but you can't match it to the workers"



Op 18 mrt. 2013 om 21:43 heeft "Bruce Weaver" <[hidden email]> het volgende geschreven:

> The project numbers are actually 101 and 102, not 1 and 2.  And notice that
> Worker 1 for Project 101 and Worker 1 for Project 102 do *not* have the same
> values for NewID.
>
> Worker 1 in Project 101 has NewID = *101*001.
> Worker 1 in Project 102 has NewID = *102*001.
>
>
>
> kwame woei wrote
>> Worker 1 in Project 1 is not the same person as Worker 1 in project 2
>> (duplicate and bizarre WrkrID's)
>>
>> Op 18 mrt. 2013 om 20:56 heeft "Bruce Weaver" <
>
>> bruce.weaver@
>
>> > het volgende geschreven:
>>
>>> I don't understand the question.  Here are the NewID values for the data
>>> that
>>> were shown.
>>>
>>> ProjID WrkrID    NewID
>>>
>>>  101      1   101001   <-- ID for Project 101, Worker 1
>>>  101      2   101002
>>>  101      3   101003
>>>  101      4   101004
>>>  102      1   102001   <-- ID for Project 102, Worker 1
>>>  102      3   102003
>>>  102      4   102004
>>>  102      5   102005
>>>  102      9   102009
>>>
>>>
>>>
>>> kwame woei wrote
>>>> But how do you solve the problem that Worker 1 in Project 1 is not the
>>>> same worker as Worker 1 in project 2? With the below you have a unique
>>>> id,
>>>> but you can't match it to the workers.
>>>>
>>>> Op 18 mrt. 2013 om 20:20 heeft "Bruce Weaver" <
>>>
>>>> bruce.weaver@
>>>
>>>> > het volgende geschreven:
>>>>
>>>>> Something like:
>>>>>
>>>>> COMPUTE NewID = ProjID*10**3 +  WrkrID.
>>>>>
>>>>> Depending on how many digits WrkrID can have, you might need/want to
>>>>> adjust
>>>>> that 10**3 up or down.
>>>>>
>>>>>
>>>>>
>>>>> Michael Pullmann wrote
>>>>>> Hi all,
>>>>>> I have a set of data received from submissions by various projects
>>>>>> (ProjID).
>>>>>> The ProjIDs were assigned by us, and therefore they are unique.
>>>>>> However,
>>>>>> the
>>>>>> projects assign their own worker ID (WrkrID). Therefore, many of the
>>>>>> worker
>>>>>> IDs are duplicates (but not all--some project assigned some fairly
>>>>>> bizarre
>>>>>> IDs). All IDs are numeric. I'd like to create a third variable that
>>>>>> uniquely
>>>>>> identifies workers, regardless of Project ID, for importing into HLM.
>>>>>> My
>>>>>> dataset currently looks like thi
>>>>>> ProjID    WrkrID
>>>>>> 101       1
>>>>>> 101       2
>>>>>> 101       3
>>>>>> 101       4
>>>>>> 102       1
>>>>>> 102       3
>>>>>> 102       4
>>>>>> 102       5
>>>>>> 102       9
>>>>>> .         .
>>>>>> .         .
>>>>>> .         .
>>>>>>
>>>>>> Thanks in advance for your help!
>>>>>>
>>>>>> =====================
>>>>>> To manage your subscription to SPSSX-L, send a message to
>>>>>
>>>>>> LISTSERV@.UGA
>>>>>
>>>>>> (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
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> -----
>>>>> --
>>>>> Bruce Weaver
>>>>>
>>>
>>>> bweaver@
>>>
>>>>> http://sites.google.com/a/lakeheadu.ca/bweaver/
>>>>>
>>>>> "When all else fails, RTFM."
>>>>>
>>>>> NOTE: My Hotmail account is not monitored regularly.
>>>>> To send me an e-mail, please use the address shown above.
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>> http://spssx-discussion.1045642.n5.nabble.com/Creating-unique-variable-from-two-variables-tp5718821p5718822.html
>>>>> Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>>>>>
>>>>> =====================
>>>>> To manage your subscription to SPSSX-L, send a message to
>>>>>
>>>
>>>> LISTSERV@.UGA
>>>
>>>> (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
>>>>
>>>> =====================
>>>> To manage your subscription to SPSSX-L, send a message to
>>>
>>>> LISTSERV@.UGA
>>>
>>>> (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
>>>
>>>
>>>
>>>
>>>
>>> -----
>>> --
>>> Bruce Weaver
>>>
>
>> bweaver@
>
>>> http://sites.google.com/a/lakeheadu.ca/bweaver/
>>>
>>> "When all else fails, RTFM."
>>>
>>> NOTE: My Hotmail account is not monitored regularly.
>>> To send me an e-mail, please use the address shown above.
>>>
>>> --
>>> View this message in context:
>>> http://spssx-discussion.1045642.n5.nabble.com/Creating-unique-variable-from-two-variables-tp5718821p5718829.html
>>> Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>>>
>>> =====================
>>> To manage your subscription to SPSSX-L, send a message to
>>>
>
>> LISTSERV@.UGA
>
>> (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
>>
>> =====================
>> To manage your subscription to SPSSX-L, send a message to
>
>> LISTSERV@.UGA
>
>> (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
>
>
>
>
>
> -----
> --
> Bruce Weaver
> [hidden email]
> http://sites.google.com/a/lakeheadu.ca/bweaver/
>
> "When all else fails, RTFM."
>
> NOTE: My Hotmail account is not monitored regularly.
> To send me an e-mail, please use the address shown above.
>
> --
> View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Creating-unique-variable-from-two-variables-tp5718821p5718835.html
> Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>
> =====================
> 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

=====================
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
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Re: Creating unique variable from two variables

David Marso
Administrator
In reply to this post by kwame woei
@kwame & @Bruce.
I am sure both of you are familiar with the TLA : TMI (Too much Information).
Well what we have here is the ever too common case of TLI (Too Little information).
Put away the Tarot cards.  Wait for OP to line up his ducks and ask a properly structured question.  At present you are both making too many assumptions.
--
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: Creating unique variable from two variables

Rich Ulrich
In reply to this post by kwame woei
It is hard to see what you are complaining about.

You have a new file that has, for Project 103, worker 1, a
unique number that is 103001.  The new file may as well
have "103" and "1" in it, too.

If you want to match back to the projects for the single
files, you have two choices.  You can match on TWO
variables (the original project and worker), or you can
create the new, unique ID and put it into every separate
project-file (if that is what you want to work from) and
and match on the new, unique ID.

For individual cases -- any time that you want to, you can
look at the unique ID and see immediately which project
it comes from.

--
Rich Ulrich



> Date: Mon, 18 Mar 2013 22:00:04 +0100

> From: [hidden email]
> Subject: Re: Creating unique variable from two variables
> To: [hidden email]
>
> You are correct.
>
> What I am saying is:
>
> ProjID wrkrID NAMEofWorker
> 101. 1. Smith
> 102. 1. Jones
>
> As Worker 1 in project 101 is not the same person as Worker 1 in project 102 it is pointless to create a new variable with unique values.
> Hence my originale question:
>
> "But how do you solve the problem that Worker 1 in Project 1 is not the
> same worker as Worker 1 in project 2? With the below [= your code] you have a unique
> id,
> but you can't match it to the workers"
>
>
>
> Op 18 mrt. 2013 om 21:43 heeft "Bruce Weaver" <[hidden email]> het volgende geschreven:
>
> > The project numbers are actually 101 and 102, not 1 and 2. And notice that
> > Worker 1 for Project 101 and Worker 1 for Project 102 do *not* have the same
> > values for NewID.
> >
> > Worker 1 in Project 101 has NewID = *101*001.
> > Worker 1 in Project 102 has NewID = *102*001.
> >
> >
> >
> > kwame woei wrote
> >> Worker 1 in Project 1 is not the same person as Worker 1 in project 2
> >> (duplicate and bizarre WrkrID's)
> >>
> >> Op 18 mrt. 2013 om 20:56 heeft "Bruce Weaver" &lt;
> >
> >> bruce.weaver@
> >
> >> &gt; het volgende geschreven:
> >>
> >>> I don't understand the question. Here are the NewID values for the data
> >>> that
> >>> were shown.
> >>>
> >>> ProjID WrkrID NewID
> >>>
> >>> 101 1 101001 <-- ID for Project 101, Worker 1
> >>> 101 2 101002
> >>> 101 3 101003
> >>> 101 4 101004
> >>> 102 1 102001 <-- ID for Project 102, Worker 1
> >>> 102 3 102003
> >>> 102 4 102004
> >>> 102 5 102005
> >>> 102 9 102009
> >>>
> >>>
> >>>
> >>> kwame woei wrote
> >>>> But how do you solve the problem that Worker 1 in Project 1 is not the
> >>>> same worker as Worker 1 in project 2? With the below you have a unique
> >>>> id,
> >>>> but you can't match it to the workers.
> >>>>
> >>>> Op 18 mrt. 2013 om 20:20 heeft "Bruce Weaver" &lt;
> >>>
> >>>> bruce.weaver@
> >>>
> >>>> &gt; het volgende geschreven:
> >>>>
> >>>>> Something like:
> >>>>>
> >>>>> COMPUTE NewID = ProjID*10**3 + WrkrID.
> >>>>>
> >>>>> Depending on how many digits WrkrID can have, you might need/want to
> >>>>> adjust
> >>>>> that 10**3 up or down.
> >>>>>
> >>>>>
> >>>>>
> >>>>> Michael Pullmann wrote
> >>>>>> Hi all,
> >>>>>> I have a set of data received from submissions by various projects
> >>>>>> (ProjID).
> >>>>>> The ProjIDs were assigned by us, and therefore they are unique.
> >>>>>> However,
> >>>>>> the
> >>>>>> projects assign their own worker ID (WrkrID). Therefore, many of the
> >>>>>> worker
> >>>>>> IDs are duplicates (but not all--some project assigned some fairly
> >>>>>> bizarre
> >>>>>> IDs). All IDs are numeric. I'd like to create a third variable that
> >>>>>> uniquely
> >>>>>> identifies workers, regardless of Project ID, for importing into HLM.
> >>>>>> My
> >>>>>> dataset currently looks like thi
> >>>>>> ProjID WrkrID
> >>>>>> 101 1
> >>>>>> 101 2
> >>>>>> 101 3
> >>>>>> 101 4
> >>>>>> 102 1
> >>>>>> 102 3
> >>>>>> 102 4
> >>>>>> 102 5
> >>>>>> 102 9
> >>>>>> . .
> >>>>>> . .
> >>>>>> . .
> >>>>>>
> >>>>>> Thanks in advance for your help!
> >>>>>>
> >>>>>> =====================
> >>>>>...[snip]
Reply | Threaded
Open this post in threaded view
|

Re: Creating unique variable from two variables

David Marso
Administrator
Reading the original post with care there is this troubling clause which suggests?
"Therefore, many of the worker
IDs are duplicates (but not all--some project assigned some fairly bizarre
IDs
)."  
Suggesting the exemplars provided in the original post are NOT the entire picture.
So?  
Also seems odd that Michael hasn't fed back into the process.

--
Rich Ulrich-2 wrote
It is hard to see what you are complaining about.

You have a new file that has, for Project 103, worker 1, a
unique number that is 103001.  The new file may as well
have "103" and "1" in it, too.

If you want to match back to the projects for the single
files, you have two choices.  You can match on TWO
variables (the original project and worker), or you can
create the new, unique ID and put it into every separate
project-file (if that is what you want to work from) and
and match on the new, unique ID.

For individual cases -- any time that you want to, you can
look at the unique ID and see immediately which project
it comes from.

--
Rich Ulrich



> Date: Mon, 18 Mar 2013 22:00:04 +0100
> From: [hidden email]
> Subject: Re: Creating unique variable from two variables
> To: [hidden email]
>
> You are correct.
>
> What I am saying is:
>
> ProjID  wrkrID NAMEofWorker
> 101.      1.        Smith
> 102.      1.        Jones
>
> As Worker 1 in project 101 is not the same person as Worker 1 in project 102 it is pointless to create a new variable with unique values.
> Hence my originale question:
>
> "But how do you solve the problem that Worker 1 in Project 1 is not the
> same worker as Worker 1 in project 2? With the below [= your code] you have a unique
> id,
> but you can't match it to the workers"
>
>
>
> Op 18 mrt. 2013 om 21:43 heeft "Bruce Weaver" <[hidden email]> het volgende geschreven:
>
> > The project numbers are actually 101 and 102, not 1 and 2.  And notice that
> > Worker 1 for Project 101 and Worker 1 for Project 102 do *not* have the same
> > values for NewID.
> >
> > Worker 1 in Project 101 has NewID = *101*001.
> > Worker 1 in Project 102 has NewID = *102*001.
> >
> >
> >
> > kwame woei wrote
> >> Worker 1 in Project 1 is not the same person as Worker 1 in project 2
> >> (duplicate and bizarre WrkrID's)
> >>
> >> Op 18 mrt. 2013 om 20:56 heeft "Bruce Weaver" <
> >
> >> bruce.weaver@
> >
> >> > het volgende geschreven:
> >>
> >>> I don't understand the question.  Here are the NewID values for the data
> >>> that
> >>> were shown.
> >>>
> >>> ProjID WrkrID    NewID
> >>>
> >>>  101      1   101001   <-- ID for Project 101, Worker 1
> >>>  101      2   101002
> >>>  101      3   101003
> >>>  101      4   101004
> >>>  102      1   102001   <-- ID for Project 102, Worker 1
> >>>  102      3   102003
> >>>  102      4   102004
> >>>  102      5   102005
> >>>  102      9   102009
> >>>
> >>>
> >>>
> >>> kwame woei wrote
> >>>> But how do you solve the problem that Worker 1 in Project 1 is not the
> >>>> same worker as Worker 1 in project 2? With the below you have a unique
> >>>> id,
> >>>> but you can't match it to the workers.
> >>>>
> >>>> Op 18 mrt. 2013 om 20:20 heeft "Bruce Weaver" <
> >>>
> >>>> bruce.weaver@
> >>>
> >>>> > het volgende geschreven:
> >>>>
> >>>>> Something like:
> >>>>>
> >>>>> COMPUTE NewID = ProjID*10**3 +  WrkrID.
> >>>>>
> >>>>> Depending on how many digits WrkrID can have, you might need/want to
> >>>>> adjust
> >>>>> that 10**3 up or down.
> >>>>>
> >>>>>
> >>>>>
> >>>>> Michael Pullmann wrote
> >>>>>> Hi all,
> >>>>>> I have a set of data received from submissions by various projects
> >>>>>> (ProjID).
> >>>>>> The ProjIDs were assigned by us, and therefore they are unique.
> >>>>>> However,
> >>>>>> the
> >>>>>> projects assign their own worker ID (WrkrID). Therefore, many of the
> >>>>>> worker
> >>>>>> IDs are duplicates (but not all--some project assigned some fairly
> >>>>>> bizarre
> >>>>>> IDs). All IDs are numeric. I'd like to create a third variable that
> >>>>>> uniquely
> >>>>>> identifies workers, regardless of Project ID, for importing into HLM.
> >>>>>> My
> >>>>>> dataset currently looks like thi
> >>>>>> ProjID    WrkrID
> >>>>>> 101       1
> >>>>>> 101       2
> >>>>>> 101       3
> >>>>>> 101       4
> >>>>>> 102       1
> >>>>>> 102       3
> >>>>>> 102       4
> >>>>>> 102       5
> >>>>>> 102       9
> >>>>>> .         .
> >>>>>> .         .
> >>>>>> .         .
> >>>>>>
> >>>>>> Thanks in advance for your help!
> >>>>>>
> >>>>>> =====================
> >>>>>...[snip]
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: Creating unique variable from two variables

mils
In reply to this post by kwame woei
You could create a new uniqueID by concatenating the variables: ProjID+wrkrID


string uniqueID (A4).
compute uniqueID = concat(ProjID, wrkrID ).
execute.

Note: transform the numeric ProjID, wrkrID  variables into string variables.

Also, I suggest you use also date in the concatenation.

http://www.ats.ucla.edu/stat/spss/faq/crstring.htm

mils
Reply | Threaded
Open this post in threaded view
|

Re: Creating unique variable from two variables

Michael Pullmann
In reply to this post by Michael Pullmann
Thanks for the help. I get this listserv in digest format and posted only
yesterday, so right now is the first I've seen of these responses.

Anyway, I considered the solution that Bruce Weaver proposed, but (as
suggested) the odd case ID numbers in some cases present formatting problems
because some of them are up to 8 digits long. Combined with the varied
project IDs, there seemed to be the possibility (though extremely remote) of
calculating the same "unique" IDs from different source IDs.

I solved the problem by using the "concatenate" function in excel and then
matching the data on the two ID variables. I tried concatenate in SPSS but
was unable to make it work for me.

So problem solved for now, thanks everyone.



On Mon, 18 Mar 2013 15:36:08 -0700, David Marso <[hidden email]>
wrote:

>Reading the original post with care there is this troubling clause which
>suggests?
>"Therefore, many of the worker
>IDs are duplicates (but not all--*some project assigned some fairly bizarre
>IDs*)."
>Suggesting the exemplars provided in the original post are *NOT* the entire
>picture.
>So?
>Also seems odd that Michael hasn't fed back into the process.
>
>--
>
>Rich Ulrich-2 wrote
>> It is hard to see what you are complaining about.
>>
>> You have a new file that has, for Project 103, worker 1, a
>> unique number that is 103001.  The new file may as well
>> have "103" and "1" in it, too.
>>
>> If you want to match back to the projects for the single
>> files, you have two choices.  You can match on TWO
>> variables (the original project and worker), or you can
>> create the new, unique ID and put it into every separate
>> project-file (if that is what you want to work from) and
>> and match on the new, unique ID.
>>
>> For individual cases -- any time that you want to, you can
>> look at the unique ID and see immediately which project
>> it comes from.
>>
>> --
>> Rich Ulrich
>>
>>
>>
>>> Date: Mon, 18 Mar 2013 22:00:04 +0100
>>> From:
>
>> kwamefacebook@
>
>>> Subject: Re: Creating unique variable from two variables
>>> To:
>
>> SPSSX-L@.UGA
>
>>>
>>> You are correct.
>>>
>>> What I am saying is:
>>>
>>> ProjID  wrkrID NAMEofWorker
>>> 101.      1.        Smith
>>> 102.      1.        Jones
>>>
>>> As Worker 1 in project 101 is not the same person as Worker 1 in project
>>> 102 it is pointless to create a new variable with unique values.
>>> Hence my originale question:
>>>
>>> "But how do you solve the problem that Worker 1 in Project 1 is not the
>>> same worker as Worker 1 in project 2? With the below [= your code] you
>>> have a unique
>>> id,
>>> but you can't match it to the workers"
>>>
>>>
>>>
>>> Op 18 mrt. 2013 om 21:43 heeft "Bruce Weaver" &lt;
>
>> bruce.weaver@
>
>> &gt; het volgende geschreven:
>>>
>>> > The project numbers are actually 101 and 102, not 1 and 2.  And notice
>>> that
>>> > Worker 1 for Project 101 and Worker 1 for Project 102 do *not* have
the

>>> same
>>> > values for NewID.
>>> >
>>> > Worker 1 in Project 101 has NewID = *101*001.
>>> > Worker 1 in Project 102 has NewID = *102*001.
>>> >
>>> >
>>> >
>>> > kwame woei wrote
>>> >> Worker 1 in Project 1 is not the same person as Worker 1 in project 2
>>> >> (duplicate and bizarre WrkrID's)
>>> >>
>>> >> Op 18 mrt. 2013 om 20:56 heeft "Bruce Weaver" &lt;
>>> >
>>> >> bruce.weaver@
>>> >
>>> >> &gt; het volgende geschreven:
>>> >>
>>> >>> I don't understand the question.  Here are the NewID values for the
>>> data
>>> >>> that
>>> >>> were shown.
>>> >>>
>>> >>> ProjID WrkrID    NewID
>>> >>>
>>> >>>  101      1   101001   <-- ID for Project 101, Worker 1
>>> >>>  101      2   101002
>>> >>>  101      3   101003
>>> >>>  101      4   101004
>>> >>>  102      1   102001   <-- ID for Project 102, Worker 1
>>> >>>  102      3   102003
>>> >>>  102      4   102004
>>> >>>  102      5   102005
>>> >>>  102      9   102009
>>> >>>
>>> >>>
>>> >>>
>>> >>> kwame woei wrote
>>> >>>> But how do you solve the problem that Worker 1 in Project 1 is not
>>> the
>>> >>>> same worker as Worker 1 in project 2? With the below you have a
>>> unique
>>> >>>> id,
>>> >>>> but you can't match it to the workers.
>>> >>>>
>>> >>>> Op 18 mrt. 2013 om 20:20 heeft "Bruce Weaver" &lt;
>>> >>>
>>> >>>> bruce.weaver@
>>> >>>
>>> >>>> &gt; het volgende geschreven:
>>> >>>>
>>> >>>>> Something like:
>>> >>>>>
>>> >>>>> COMPUTE NewID = ProjID*10**3 +  WrkrID.
>>> >>>>>
>>> >>>>> Depending on how many digits WrkrID can have, you might need/want
>>> to
>>> >>>>> adjust
>>> >>>>> that 10**3 up or down.
>>> >>>>>
>>> >>>>>
>>> >>>>>
>>> >>>>> Michael Pullmann wrote
>>> >>>>>> Hi all,
>>> >>>>>> I have a set of data received from submissions by various
projects
>>> >>>>>> (ProjID).
>>> >>>>>> The ProjIDs were assigned by us, and therefore they are unique.
>>> >>>>>> However,
>>> >>>>>> the
>>> >>>>>> projects assign their own worker ID (WrkrID). Therefore, many of
>>> the
>>> >>>>>> worker
>>> >>>>>> IDs are duplicates (but not all--some project assigned some
fairly

>>> >>>>>> bizarre
>>> >>>>>> IDs). All IDs are numeric. I'd like to create a third variable
>>> that
>>> >>>>>> uniquely
>>> >>>>>> identifies workers, regardless of Project ID, for importing into
>>> HLM.
>>> >>>>>> My
>>> >>>>>> dataset currently looks like thi
>>> >>>>>> ProjID    WrkrID
>>> >>>>>> 101       1
>>> >>>>>> 101       2
>>> >>>>>> 101       3
>>> >>>>>> 101       4
>>> >>>>>> 102       1
>>> >>>>>> 102       3
>>> >>>>>> 102       4
>>> >>>>>> 102       5
>>> >>>>>> 102       9
>>> >>>>>> .         .
>>> >>>>>> .         .
>>> >>>>>> .         .
>>> >>>>>>
>>> >>>>>> Thanks in advance for your help!
>>> >>>>>>
>>> >>>>>> =====================
>>> >>>>>...[snip]
>
>
>
>
>
>-----
>Please reply to the list and not to my personal email.
>Those desiring my consulting or training services please feel free to email
me.
>--
>View this message in context: http://spssx-
discussion.1045642.n5.nabble.com/Creating-unique-variable-from-two-
variables-tp5718821p5718841.html
>Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>
>=====================
>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

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: Creating unique variable from two variables

Bruce Weaver
Administrator
Which is exactly why I said, "Depending on how many digits WrkrID can have, you might need/want to adjust that 10**3 up or down."  Rather than mess around in Excel, you could do this:

* Create some sample data.

data list list / ProjID (f3.0) WrkrID (f8.0).
begin data
101       1
101       2
101       3
101       4
102       1
102       3
102       4
102       5
102       9
103       12345678
end data.

COMPUTE NewID = ProjID*10**8 +  WrkrID.
FORMATS NewID (f12.0).
LIST.

OUTPUT:

ProjID   WrkrID        NewID
  101         1  10100000001
  101         2  10100000002
  101         3  10100000003
  101         4  10100000004
  102         1  10200000001
  102         3  10200000003
  102         4  10200000004
  102         5  10200000005
  102         9  10200000009
  103  12345678  10312345678


Michael Pullmann wrote
Thanks for the help. I get this listserv in digest format and posted only
yesterday, so right now is the first I've seen of these responses.

Anyway, I considered the solution that Bruce Weaver proposed, but (as
suggested) the odd case ID numbers in some cases present formatting problems
because some of them are up to 8 digits long. Combined with the varied
project IDs, there seemed to be the possibility (though extremely remote) of
calculating the same "unique" IDs from different source IDs.

I solved the problem by using the "concatenate" function in excel and then
matching the data on the two ID variables. I tried concatenate in SPSS but
was unable to make it work for me.

So problem solved for now, thanks everyone.



On Mon, 18 Mar 2013 15:36:08 -0700, David Marso <[hidden email]>
wrote:

>Reading the original post with care there is this troubling clause which
>suggests?
>"Therefore, many of the worker
>IDs are duplicates (but not all--*some project assigned some fairly bizarre
>IDs*)."
>Suggesting the exemplars provided in the original post are *NOT* the entire
>picture.
>So?
>Also seems odd that Michael hasn't fed back into the process.
>
>--
>
>Rich Ulrich-2 wrote
>> It is hard to see what you are complaining about.
>>
>> You have a new file that has, for Project 103, worker 1, a
>> unique number that is 103001.  The new file may as well
>> have "103" and "1" in it, too.
>>
>> If you want to match back to the projects for the single
>> files, you have two choices.  You can match on TWO
>> variables (the original project and worker), or you can
>> create the new, unique ID and put it into every separate
>> project-file (if that is what you want to work from) and
>> and match on the new, unique ID.
>>
>> For individual cases -- any time that you want to, you can
>> look at the unique ID and see immediately which project
>> it comes from.
>>
>> --
>> Rich Ulrich
>>
>>
>>
>>> Date: Mon, 18 Mar 2013 22:00:04 +0100
>>> From:
>
>> kwamefacebook@
>
>>> Subject: Re: Creating unique variable from two variables
>>> To:
>
>> SPSSX-L@.UGA
>
>>>
>>> You are correct.
>>>
>>> What I am saying is:
>>>
>>> ProjID  wrkrID NAMEofWorker
>>> 101.      1.        Smith
>>> 102.      1.        Jones
>>>
>>> As Worker 1 in project 101 is not the same person as Worker 1 in project
>>> 102 it is pointless to create a new variable with unique values.
>>> Hence my originale question:
>>>
>>> "But how do you solve the problem that Worker 1 in Project 1 is not the
>>> same worker as Worker 1 in project 2? With the below [= your code] you
>>> have a unique
>>> id,
>>> but you can't match it to the workers"
>>>
>>>
>>>
>>> Op 18 mrt. 2013 om 21:43 heeft "Bruce Weaver" <
>
>> bruce.weaver@
>
>> > het volgende geschreven:
>>>
>>> > The project numbers are actually 101 and 102, not 1 and 2.  And notice
>>> that
>>> > Worker 1 for Project 101 and Worker 1 for Project 102 do *not* have
the
>>> same
>>> > values for NewID.
>>> >
>>> > Worker 1 in Project 101 has NewID = *101*001.
>>> > Worker 1 in Project 102 has NewID = *102*001.
>>> >
>>> >
>>> >
>>> > kwame woei wrote
>>> >> Worker 1 in Project 1 is not the same person as Worker 1 in project 2
>>> >> (duplicate and bizarre WrkrID's)
>>> >>
>>> >> Op 18 mrt. 2013 om 20:56 heeft "Bruce Weaver" <
>>> >
>>> >> bruce.weaver@
>>> >
>>> >> > het volgende geschreven:
>>> >>
>>> >>> I don't understand the question.  Here are the NewID values for the
>>> data
>>> >>> that
>>> >>> were shown.
>>> >>>
>>> >>> ProjID WrkrID    NewID
>>> >>>
>>> >>>  101      1   101001   <-- ID for Project 101, Worker 1
>>> >>>  101      2   101002
>>> >>>  101      3   101003
>>> >>>  101      4   101004
>>> >>>  102      1   102001   <-- ID for Project 102, Worker 1
>>> >>>  102      3   102003
>>> >>>  102      4   102004
>>> >>>  102      5   102005
>>> >>>  102      9   102009
>>> >>>
>>> >>>
>>> >>>
>>> >>> kwame woei wrote
>>> >>>> But how do you solve the problem that Worker 1 in Project 1 is not
>>> the
>>> >>>> same worker as Worker 1 in project 2? With the below you have a
>>> unique
>>> >>>> id,
>>> >>>> but you can't match it to the workers.
>>> >>>>
>>> >>>> Op 18 mrt. 2013 om 20:20 heeft "Bruce Weaver" <
>>> >>>
>>> >>>> bruce.weaver@
>>> >>>
>>> >>>> > het volgende geschreven:
>>> >>>>
>>> >>>>> Something like:
>>> >>>>>
>>> >>>>> COMPUTE NewID = ProjID*10**3 +  WrkrID.
>>> >>>>>
>>> >>>>> Depending on how many digits WrkrID can have, you might need/want
>>> to
>>> >>>>> adjust
>>> >>>>> that 10**3 up or down.
>>> >>>>>
>>> >>>>>
>>> >>>>>
>>> >>>>> Michael Pullmann wrote
>>> >>>>>> Hi all,
>>> >>>>>> I have a set of data received from submissions by various
projects
>>> >>>>>> (ProjID).
>>> >>>>>> The ProjIDs were assigned by us, and therefore they are unique.
>>> >>>>>> However,
>>> >>>>>> the
>>> >>>>>> projects assign their own worker ID (WrkrID). Therefore, many of
>>> the
>>> >>>>>> worker
>>> >>>>>> IDs are duplicates (but not all--some project assigned some
fairly
>>> >>>>>> bizarre
>>> >>>>>> IDs). All IDs are numeric. I'd like to create a third variable
>>> that
>>> >>>>>> uniquely
>>> >>>>>> identifies workers, regardless of Project ID, for importing into
>>> HLM.
>>> >>>>>> My
>>> >>>>>> dataset currently looks like thi
>>> >>>>>> ProjID    WrkrID
>>> >>>>>> 101       1
>>> >>>>>> 101       2
>>> >>>>>> 101       3
>>> >>>>>> 101       4
>>> >>>>>> 102       1
>>> >>>>>> 102       3
>>> >>>>>> 102       4
>>> >>>>>> 102       5
>>> >>>>>> 102       9
>>> >>>>>> .         .
>>> >>>>>> .         .
>>> >>>>>> .         .
>>> >>>>>>
>>> >>>>>> Thanks in advance for your help!
>>> >>>>>>
>>> >>>>>> =====================
>>> >>>>>...[snip]
>
>
>
>
>
>-----
>Please reply to the list and not to my personal email.
>Those desiring my consulting or training services please feel free to email
me.
>--
>View this message in context: http://spssx-
discussion.1045642.n5.nabble.com/Creating-unique-variable-from-two-
variables-tp5718821p5718841.html
>Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>
>=====================
>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

=====================
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
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).