identical individuals

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

identical individuals

Tore Viland

Technical info: SPSS 17.0.2

Data: longitudinal panel data

 

Hi

I have a problem identifying duplicate cases, and recoding these values according to my needs.

I have a short longitudinal panel data set (3 years), in which there are multiple observations for each individual. Each individual is only observed once, for each year, and a unique identity (id) makes it possible to follow the same individual for multiple periods. However, there are also individuals who are observed for periods less than 3 years in these data.

When running a 'duplicate tag’, I receive the values 1, 2, 3, if there are multiple records, and zero otherwise.

What I wish to do is to recode so that I can keep track of all the values labeled 3. This indicates that I need to recode the variable in such a manner that whenever there is a '3' it also need to be '3' where it now it either '2' or '1'. This would allow me to keep only individuals that are observed throughout the data-set.

Thus, the goal of the recode is to keep track of the unique observations that stay throughout the three year time-period.


Best regards,


Tore

(Norway)

Reply | Threaded
Open this post in threaded view
|

Re: identical individuals

Richard Ristow
At 01:26 PM 5/14/2009, Tore Viland wrote:

I have a short longitudinal panel data set (3 years), in which there are multiple observations for each individual. Each individual is observed once, for each year, and a unique identity (id) makes it possible to follow the same individual for multiple periods. However, there are also individuals who are observed for periods less than 3 years in these data.

When running a 'duplicate tag’, I receive the values 1, 2, 3, if there are multiple records, and zero otherwise. I wish to keep track of all the values labeled 3. This indicates that I need to recode the variable in such a manner that whenever there is a '3' it also need to be '3' where it now it either '2' or '1'.

I'm not sure what you mean by "running a 'duplicate tag’". I thought, "Identify Duplicate Cases..." from the Data menu, but that does something else.

Anyway, here's code that does what I think you want:
|-----------------------------|---------------------------|
|Output Created               |15-MAY-2009 16:56:10       |
|-----------------------------|---------------------------|
  id

   1
   2
   2
   3
   4
   4
   4
   4
   5

Number of cases read:  9    Number of cases listed:  9

 
*  ....  To add the number of observations for the .... .
*  ....  individual to every record:               .... .

AGGREGATE OUTFILE=* MODE=ADDVARIABLES
   /BREAK = id
   /NObs 'Number of observations for this id' = NU.

LIST.

List
|-----------------------------|---------------------------|
|Output Created               |15-MAY-2009 16:56:11       |
|-----------------------------|---------------------------|
  id    NObs

   1       1
   2       2
   2       2
   3       1
   4       4
   4       4
   4       4
   4       4
   5       1

Number of cases read:  9    Number of cases listed:  9

=============================
APPENDIX: Test data, and code
=============================

DATA LIST FREE / id.
BEGIN DATA
1 2 2 3 4 4 4 4 5
END DATA.

FORMATS id (F4).
LIST.

*  ....  To add the number of observations for the .... .
*  ....  individual to every record:               .... .

AGGREGATE OUTFILE=* MODE=ADDVARIABLES
   /BREAK = id
   /NObs 'Number of observations for this id' = NU.

LIST.

===================== 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: identical individuals

Tore Viland

Thank you Richard,

 

The code you provided functioned perfectly, and was just what I needed. Now, I am able to perform a set of analysis that I have not been able to do, due to the difficulties I had figuring out how to create the variable. Thank you for teaching me!

 

And yes, I was trying to use the "Identify Duplicate Cases", which apparently did not work at all.

 

 

Best,

 

Tore



On Fri, May 15, 2009 at 10:58 PM, Richard Ristow <[hidden email]> wrote:
At 01:26 PM 5/14/2009, Tore Viland wrote:

I have a short longitudinal panel data set (3 years), in which there are multiple observations for each individual. Each individual is observed once, for each year, and a unique identity (id) makes it possible to follow the same individual for multiple periods. However, there are also individuals who are observed for periods less than 3 years in these data.

When running a 'duplicate tag’, I receive the values 1, 2, 3, if there are multiple records, and zero otherwise. I wish to keep track of all the values labeled 3. This indicates that I need to recode the variable in such a manner that whenever there is a '3' it also need to be '3' where it now it either '2' or '1'.

I'm not sure what you mean by "running a 'duplicate tag’". I thought, "Identify Duplicate Cases..." from the Data menu, but that does something else.

Anyway, here's code that does what I think you want:
|-----------------------------|---------------------------|
|Output Created               |15-MAY-2009 16:56:10       |
|-----------------------------|---------------------------|
  id

   1
   2
   2
   3
   4
   4
   4
   4
   5

Number of cases read:  9    Number of cases listed:  9

 
*  ....  To add the number of observations for the .... .
*  ....  individual to every record:               .... .

AGGREGATE OUTFILE=* MODE=ADDVARIABLES
   /BREAK = id
   /NObs 'Number of observations for this id' = NU.

LIST.

List
|-----------------------------|---------------------------|
|Output Created               |15-MAY-2009 16:56:11       |
|-----------------------------|---------------------------|
  id    NObs

   1       1
   2       2
   2       2
   3       1
   4       4
   4       4
   4       4
   4       4
   5       1

Number of cases read:  9    Number of cases listed:  9

=============================
APPENDIX: Test data, and code
=============================

DATA LIST FREE / id.
BEGIN DATA
1 2 2 3 4 4 4 4 5
END DATA.

FORMATS id (F4).
LIST.

*  ....  To add the number of observations for the .... .
*  ....  individual to every record:               .... .

AGGREGATE OUTFILE=* MODE=ADDVARIABLES
   /BREAK = id
   /NObs 'Number of observations for this id' = NU.

LIST.