How to flag individuals who participated 3 years in a row

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

How to flag individuals who participated 3 years in a row

Björn Türoque
I have a dataset with where data was collected over 3 years, some
individuals dropped out some individuals came on, but it seems like the
majority of those that participated in the first year also participated in
the last year. I want to figure out how many people participated in all
three years. Each year for each person is entered as its own record so
person 001 in year 2003 is stored 0012003 person 002 is 0022003 and so on.

The data has the aforementioned unique ID; a respondent ID; and the year
participated.

I tried sorting by year then unique Id then using a lag function to mark all
of the cases with a 1 if the case above has the same ID as the case being
examined. This lets me know if the person has participated before, but
doesn't tell me if they participated in all 3 years. I would like to come up
with a way to mark all of the individual cases if and only if they have
participated in all three years. Any suggestions would be helpful.

=====================
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: How to flag individuals who participated 3 years in a row

Norton, John
Hi Don,

You can aggregate the file (Data .. Aggregate..) on the keys you mentioned, and request that the aggregate function count the number of occurrences.  If you select the option to save the aggregated data to an external file, you can then select those case IDs (using Data..  Select Cases [and delete all unselected cases]) which have 3 occurrences.  Then you can use that subset of cases as a table lookup to merge with the original data file (Data .. Merge files .. Add variables..) and thereby flag all cases which met your criteria.

HTH,

John Norton
SPSS Inc.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Don Asay
Sent: Thursday, January 17, 2008 2:12 PM
To: [hidden email]
Subject: How to flag individuals who participated 3 years in a row

I have a dataset with where data was collected over 3 years, some
individuals dropped out some individuals came on, but it seems like the
majority of those that participated in the first year also participated in
the last year. I want to figure out how many people participated in all
three years. Each year for each person is entered as its own record so
person 001 in year 2003 is stored 0012003 person 002 is 0022003 and so on.

The data has the aforementioned unique ID; a respondent ID; and the year
participated.

I tried sorting by year then unique Id then using a lag function to mark all
of the cases with a 1 if the case above has the same ID as the case being
examined. This lets me know if the person has participated before, but
doesn't tell me if they participated in all 3 years. I would like to come up
with a way to mark all of the individual cases if and only if they have
participated in all three years. Any suggestions would be helpful.

=====================
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: How to flag individuals who participated 3 years in a row

Maguin, Eugene
In reply to this post by Björn Türoque
Don,

Although I can't quite tell from your description, I think you were very
close to solving the problem. I think that if you sorted by respondent id
and year (not the unique id: resp id + year) and then did this, you'd have
it. This assumes that assessments were only once a year.

Compute recs=0.
If (respid eq lag(respid)) recs=lag(recs)+1.

Frequencies recs.


You could also just aggregate the file on respid and add a new variable,
count, equal to nu. The do a frequencies on count.


Let me add that what I describe tells you how many assessments each person
completed. That is different from flagging persons who participated three
years in a row, meaning they completed three assessments.

Gene Maguin

=====================
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: How to flag individuals who participated 3 years in a row

Peck, Jon
In reply to this post by Norton, John
With slightly recent versions of SPSS, just add the aggregated count back to the original variables.  No need to save a separate file and merge.

-Jon Peck

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Norton, John
Sent: Thursday, January 17, 2008 1:28 PM
To: [hidden email]
Subject: Re: [SPSSX-L] How to flag individuals who participated 3 years in a row

Hi Don,

You can aggregate the file (Data .. Aggregate..) on the keys you mentioned, and request that the aggregate function count the number of occurrences.  If you select the option to save the aggregated data to an external file, you can then select those case IDs (using Data..  Select Cases [and delete all unselected cases]) which have 3 occurrences.  Then you can use that subset of cases as a table lookup to merge with the original data file (Data .. Merge files .. Add variables..) and thereby flag all cases which met your criteria.

HTH,

John Norton
SPSS Inc.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Don Asay
Sent: Thursday, January 17, 2008 2:12 PM
To: [hidden email]
Subject: How to flag individuals who participated 3 years in a row

I have a dataset with where data was collected over 3 years, some
individuals dropped out some individuals came on, but it seems like the
majority of those that participated in the first year also participated in
the last year. I want to figure out how many people participated in all
three years. Each year for each person is entered as its own record so
person 001 in year 2003 is stored 0012003 person 002 is 0022003 and so on.

The data has the aforementioned unique ID; a respondent ID; and the year
participated.

I tried sorting by year then unique Id then using a lag function to mark all
of the cases with a 1 if the case above has the same ID as the case being
examined. This lets me know if the person has participated before, but
doesn't tell me if they participated in all 3 years. I would like to come up
with a way to mark all of the individual cases if and only if they have
participated in all three years. Any suggestions would be helpful.

=====================
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

=====================
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