|
Technical info: SPSS 17.0.2 Data: longitudinal panel data
Hi (Norway) |
|
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. 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 |
|
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:
|
| Free forum by Nabble | Edit this page |
