Counting person-id scores in "long" panel data

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

Counting person-id scores in "long" panel data

nina
Dear all,

I have panel data in a long format, that is, each line corresponds to a single measurement of one person.

Persons are identified using a variable labelled person_ID.

Persons have been measured up to four times, but others have been measured only once or twice - like this:

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

I now want to extract only those persons who participated four times in the panel (e.g. person 3 or 4 in the above example) using the person-specific scores in the variable person_id, but I failed to produce an adequate syntax...

Can anybody  please help me out here – what kind of syntax might help?
Many thanks in advance,

Nina
Reply | Threaded
Open this post in threaded view
|

Re: Counting person-id scores in "long" panel data

Bruce Weaver
Administrator
Use AGGREGATE to add a new variable to the file reporting the number of records for each id.  Something like this (untested):

AGGREGATE
 /OUTFILE = * MODE=ADDVARIABLES
 /BREAK = person_ID
 /NumRecs = NU.

FREQUENCIES NumRecs.
* Keep only Ss who have at least 4 records.
SELECT IF NumRecs GE 4.
FREQUENCIES NumRecs.


nina wrote
Dear all,

I have panel data in a long format, that is, each line corresponds to a single measurement of one person.

Persons are identified using a variable labelled person_ID.

Persons have been measured up to four times, but others have been measured only once or twice - like this:

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

I now want to extract only those persons who participated four times in the panel (e.g. person 3 or 4 in the above example) using the person-specific scores in the variable person_id, but I failed to produce an adequate syntax...

Can anybody  please help me out here – what kind of syntax might help?
Many thanks in advance,

Nina
--
Bruce Weaver
bweaver@lakeheadu.ca
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.