Date: Thu, 9 Dec 2004 10:27:19 -0500
Reply-To: "Hilsdon, Roberta H." <RHR1@CDC.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Hilsdon, Roberta H." <RHR1@CDC.GOV>
Subject: Date question
Content-Type: text/plain; charset="US-ASCII"
The data look like the printout below. Here's what I'm trying to
accomplish. For each worker by job title I want the number of months by
year worked. For example:
John Doe 1964 16
John Doe 1965 148
John Doe 1966 110
John Doe 1967 12.5
I don't have a problem when the dates are in one year. Its when they
span years and for example I want to get the number of months from
August to December (but there's no existing date for December on the
file).
The SAS System
08:30 Thursday, December 9, 2004 1
Obs Worker JobTitle JobStart
JobEnd Months
1 John Doe Construction 25AUG1964:00:00:00
11OCT1965:00:00:00 14.0
2 John Doe Miller 11OCT1965:00:00:00
21FEB1966:00:00:00 5.0
3 John Doe Unemployed* 21FEB1966:00:00:00
14MAR1966:00:00:00 0.5
4 John Doe Sweeper 14MAR1966:00:00:00
24MAR1967:00:00:00 12.0
5 John Doe Driver 24MAR1967:00:00:00
15APR1967:00:00:00 0.5
Exposure
start_
Obs Level Exposure newstart newend
numdays year end_year
1 4 56.0 08/25/1964 10/11/1965
. 1964 1965
2 36 180.0 10/11/1965 02/21/1966
. 1965 1966
3 0 0.0 02/21/1966 03/14/1966
. 1966 1966
4 4 48.0 03/14/1966 03/24/1967
. 1966 1967
5 1 0.5 03/24/1967 04/15/1967
. 1967 1967