Date: Thu, 1 May 2003 17:35:00 -0400
Reply-To: Nancy Crowell <nac2@georgetown.edu>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Nancy Crowell <nac2@georgetown.edu>
Organization: Georgetown University
Subject: Re: Syntax help-working with lag & loops
Content-Type: text/plain; charset=us-ascii
Clarification:
I don't want to aggregate by job number. The variable I want to create is
for each job the cumulative months employed -- so for job #1, the months
in the job equal the total months employed; for job #2, total months =
months in job 1 plus months in job 2. and so forth. I am going to be
running an event history analysis which requires that each job be a case
of its own, meaning that for any given id there will be multiple cases
unless they have only had one job in their entire career.
Hope that clarifies my question.
Thanks.
Richard Ristow wrote:
> At 11:16 AM 5/1/2003 -0400, Nancy Crowell wrote:
>
> >I have a data file that has multiple records for each id number--each
> >record corresponds to a job held by the individual. The first thing I
> >want to do is to create a variable 'total months employed'.
> >
> >Data looks like this
> >
> >ID Jobnbr Jstart Jend JMos
> >1 1 1/1982 6/1984 29
> >1 2 7/1984 6/1988 47
> >1 3 7/1988 6/1995 83
> >1 4 7/1995 6/1998 35
> >1 5 7/1998 2/2003 56
> >2 1 9/1977 5/1981 44
> >2 2 5/1981 8/1982 15
> >2 3 8/1982 7/1983 11
> >2 4 7/1983 1/2003 234
> >3 1 9/1974 8/1978 47
> >3 2 8/1980 1/2003 269
> >
> >For each successive job for each person I want to create a variable
> >that shows the number of total months employed (i.e. jstart for job=1
> >subtracted from jend for job in question).
>
> I'm not *quite* clear. It looks like your variable "JMos" has total
> months employed for that person for that job, as you were looking for.
> Are you having trouble calculating "JMos"?
>
> In the meantime, if you want to combine to total months employed per
> person in any job, while it can be done with LAG, AGGREGATE is much
> easier and more natural:
>
> AGGREGATE/OUTFILE=*/BREAK=ID/
> EmpMos 'Total months employed, all jobs'= SUM(JMos).
>
> Does this get you near where you want to go?
|