Date: Thu, 10 Apr 1997 16:55:57 -0500
Reply-To: Yuxian Jiang <joan.jiang.10@ND.EDU>
Sender: "SPSSX(r) Discussion" <SPSSX-L@UGA.CC.UGA.EDU>
From: Yuxian Jiang <joan.jiang.10@ND.EDU>
Subject: Re: changing units of analysis
In-Reply-To: <199704101710.AA20212@gate1.health.state.ny.us>
Content-Type: text/plain; charset="us-ascii"
Please modify the following codes so that it reads whole input data. File
OUT1 holds the data with the format that you want. Good luck! --Joan
Jiang
DATA LIST
/PID 1-2 (A) /*personid
FID 5-7 (A) /*familyid
OTH 10-12 (A) /*other stuff
BEGIN DATA
01 001 234
02 001 098
03 002 743
04 003 432
05 003 321
06 003 431
END DATA
SORT CASES BY FID
IF (FID NE LAG(FID,1)) X=0 /*Initialize for new FID
COMPUTE X=X+1
LEAVE X
FORMAT X (F1)
EXE
/*Assume that the max number of record per familyid is 9
VECTOR VPID(9A3) VFID(9A4) VOTH(9A4)
COMPUTE VPID(X)=PID
COMPUTE VFID(X)=FID
COMPUTE VOTH(X)=OTH
AGGREGATE OUTFILE=*
/BREAK=FID
/VPID1 TO VPID9=MAX(VPID1 TO VPID9)
/VFID1 TO VFID9=MAX(VFID1 TO VFID9)
/VOTH1 TO VOTH9=MAX(VOTH1 TO VOTH9)
WRITE OUTFILE=OUT1
/VPID1 VFID1 VOTH1 VPID2 VFID2 VOTH2 VPID3 VFID3 VOTH3
VPID4 VFID4 VOTH4 VPID5 VFID5 VOTH5 VPID6 VFID6 VOTH6
VPID7 VFID7 VOTH7 VPID8 VFID8 VOTH8 VPID9 VFID9 VOTH9
EXE
>Hi,
>
>We are using part of CPS data, and trying to put individuals together
>into families.
>
>That is, each individual in the CPS data set has one record, which
>includes a family ID (called sequence number). There are other
>individuals in the data set with the same family ID, so they are
>in the same family. However, each family is made up of different
>numbers of individuals. Is there any way to manipulate the data set
>to put the individuals together into a single record, one for each
>family?
>
>Currently, the data set looks something like:
>
>personid, familyid, other stuff
>
>01 001 234
>02 001 098
>03 002 743
>04 003 432
>05 003 321
>06 003 431
>
>and we would like it to look like:
>
>01 001 234 01 001 098
>03 002 743
>04 003 432 05 003 321 06 003 431
>
>so that each person with the same family id is on the same card.
>Can spss do this? We are using spss for windows, but I presume
>it would have similar commands to spssx.
>
|