Date: Sun, 16 Jun 2002 20:45:18 -0400
Reply-To: Raynald Levesque <rlevesque@videotron.ca>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Raynald Levesque <rlevesque@videotron.ca>
Subject: Re: Challenging problem with placement data
In-Reply-To: <GCENIMMELINBMBNMIANMGEDOCJAA.leitzel@adelphia.net>
Content-Type: text/plain; charset="iso-8859-1"
Hi
This should get you going:
* Next vector will contain # of child-days per setting.
VECTOR settng(18F8.0).
RECODE settng1 TO settng18 (SYSMIS=0).
* Replace missing end dates by 31/12/2001 or 31/12/2000.
DO REPEAT dt=p01in p02in p03in p04in p05in
open01 open02 open03 open04 open05
p01out p02out p03out p04out p05out
close01 close02 close03 close04 close05.
DO IF MISSING(dt).
+ DO IF group=0.
+ COMPUTE dt=DATE.DMY(31,12,2001).
+ ELSE.
+ COMPUTE dt=DATE.DMY(31,12,2000).
+ END IF.
END IF.
END REPEAT PRINT.
* Calculate total time in placement by setting per child.
* Calculate period files were open in 2000 (2001) as well as
during the preceding 3 years.
* Note: if a family has 2 files opened during a given month, the syntax
counts 2 months for that period.
DO REPEAT dtin1 =p01in p02in p03in p04in p05in
/dtin2 =p01out p02out p03out p04out p05out
/dtopen1 =open01 open02 open03 open04 open05
/dtopen2 =close01 close02 close03 close04 close05
/nb =p01num p02num p03num p04num p05num
/where =p01where p02where p03where p04where p05where.
IF ~MISSING(where) settng(where)=SUM(settng(where),nb*CTIME.DAYS(
MAX(dtin2,dtin1)-dtin1)
).
DO IF group=0.
+ COMPUTE time1yr=SUM(time1yr,CTIME.DAYS(
MIN(MAX(dtopen2,DATE.DMY(1,1,2001)),DATE.DMY(31,12,2001))-
MAX(MIN(dtopen1,DATE.DMY(31,12,2001)),DATE.DMY(1,1,2001)))
).
+ COMPUTE time3yrs=SUM(time3yrs,CTIME.DAYS(
MIN(MAX(dtopen2,DATE.DMY(1,1,1998)),DATE.DMY(31,12,2000))-
MAX(MIN(dtopen1,DATE.DMY(31,12,2000)),DATE.DMY(1,1,1998)))
).
ELSE.
+ COMPUTE time1yr=SUM(time1yr,CTIME.DAYS(
MIN(MAX(dtopen2,DATE.DMY(1,1,2000)),DATE.DMY(31,12,2000))-
MAX(MIN(dtopen1,DATE.DMY(31,12,2000)),DATE.DMY(1,1,2000)))
).
+ COMPUTE time3yrs=SUM(time3yrs,CTIME.DAYS(
MIN(MAX(dtopen2,DATE.DMY(1,1,1997)),DATE.DMY(31,12,1999))-
MAX(MIN(dtopen1,DATE.DMY(31,12,1999)),DATE.DMY(1,1,1997)))
).
END IF.
END REPEAT PRINT.
EXECUTE.
Regards
Raynald Levesque rlevesque@videotron.ca
Visit my SPSS Pages http://pages.infinit.net/rlevesqu/index.htm
-----Original Message-----
From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU]On Behalf Of
Dr. Jeffrey D. Leitzel
Sent: June 14, 2002 5:11 PM
To: SPSSX-L@LISTSERV.UGA.EDU
Subject: Challenging problem with placement data
Greetings to all who are interested in solving challenging problems, since I
am not even sure where to start with this one.
Here is what I need to do.
I have a data set containing among many other variables, information on case
opening and closing dates for families with a children’s service agency,
dates of placements and how many children from the family were placed are
also on the file. The setting of each placement is indicated as well. The
file is further split into two groups, the first, consists of folks whose
case was handled via mediation during 2001, the second is families whose
cases were resolved via the traditional court hearing route. I need to
calculate the total time in placement by setting per child and total time
the case was open (in days is fine) for 2001 for the mediation group and for
2000 for the hearing group. In addition, since I am controlling in my
analyses for the total time the family has had a case open prior to the
index year and the time in placement per child prior to the index year, I
need to calculate the same totals for the mediation group for 1998, 1999,
and 2000 (can be lumped together) and for the hearing group for 1997, 1998,
and 1999.
The difficulty comes (for me in terms of conceptualizing how to do this) in
the diversity in the data. Some of the openings and closings span the cut
off points for the different groups.
There are potentially as many as 10 sets of “in and out” dates for
placements, some of these may be for partially or totally overlapping
periods if different children in the family were placed for different
periods of time. Along with each pair of “in and out” dates are variables
indicating how many children were placed and one indicating the setting of
the placement.
I am also going to want to calculate the total “child days” of placement for
each case for each of the settings.
All of the case openings and closings are entered in sequential variables,
most recent to most distant, e.g. most recent placement is in p01in/p01out
and most recent case opening is in open01 close01. In the full data file
there are 10 sets of each pair of date variables. And a final bit of
complication, if there is a most recent case open or placement date, without
a corresponding closing (or out of placement) date, we’ll use 12-31-01 as
the end/close date for the mediation group (group = 0) and 12-31-00 as the
date for the court group (group = 1).
Following is syntax that generates the needed data for 17 cases from the
file for anyone (Ray, are you listening :-)) who is interested in taking a
crack at this.
This is just a small sample of cases and variables from the full data set,
but it should be sufficient to give the general idea for anyone who has
ideas about how to solve this problem.
Thanks in advance to all who have a look and especially to those of you who
might be able to offer useful guidance on this one.
Best,
Jeff
Jeffrey D. Leitzel, Ph.D.
Executive Director
Behavioral Health Research Institute
326 Adams Avenue
Scranton, PA 18503
ph - 570 650-6286
fax - 570 383-6847
ph - 570 383-6849 (home)
pager - 570 480-5753
e - director@BHRI.net
Syntax follows below:
DATA LIST RECORDS = 4
/1 casenum 1-3(F) numkids 10(F) group 13(F) p01num 16(F)
p01where 18-19(F) p01in 21-30(ADATE) p01out 32-41(ADATE)
p02num 44(F) p02where 46-47(F) p02in 49-58(ADATE)
p02out 60-69(ADATE) p03num 72(F) p03where 74-75(F)
/2 p03in 1-10(ADATE) p03out 12-21(ADATE) p04num 24(F)
p04where 26-27(F) p04in 29-38(ADATE) p04out 40-49(ADATE)
p05num 52(F) p05where 54-55(F) p05in 57-66(ADATE)
p05out 68-77(ADATE)
/3 open01 1-10(ADATE) close01 12-21(ADATE) open02 23-32(ADATE)
close02 34-43(ADATE) open03 45-54(ADATE) close03 56-65(ADATE)
open04 67-76 (ADATE)
/4 close04 1-10(ADATE) open05 12-21(ADATE) close05 23-32(ADATE).
Value labels group 0 'mediation' 1 'court'
/p01where p02where p03where p04where p05where
1 'Parents' 2 'Friends of family' 3 'Neighbor' 4 'Foster care'
5 'Specialized Foster Care' 6 'Therapeutic Foster Care'
7 'Emergency Shelter' 8 'Group Home' 9 'Residential'
10 'Day Program' 11 'Respite care' 12 'Diagnostic'
13 'Juvenile Detention' 14 'Jail' 15 'Psychiatric Hospital'
16 'Drug and Alcohol Treatment' 17 'Partial Hospitalization'
18 'Extended family'.
BEGIN DATA
18 2 0 1 5 09/05/2000 07/01/2001 1 4 06/06/2000 09/05/2000 1 9
05/24/2000 06/06/2000 . . . . . . .
.
05/12/2000 . . . . . .
. . .
27 1 0 1 4 08/15/2001 . . . . . . .
. . . . . . . . .
.
08/15/2001 . . . . . .
. . .
32 3 0 3 4 01/22/2001 . 3 7 01/18/2001 01/22/2001 . .
. . . . . . . . .
.
01/18/2001 . 09/19/1997 06/02/1998 . . .
. . .
39 4 0 4 18 10/01/2001 10/15/2001 . . . . . .
. . . . . . . . .
.
12/22/1999 . 01/22/1999 04/23/1999 . . .
. . .
46 3 0 1 7 10/25/2000 11/17/2000 1 9 01/05/2000 06/16/2000 1 4
05/29/1998 01/05/2000 1 4 05/29/1998 12/18/1998 . . .
.
11/15/1996 . . . . . .
. . .
47 2 0 1 1 06/01/2001 . 1 18 04/17/2001 06/18/2001 1 9
03/24/2001 03/29/2001 . . . . . . .
.
01/07/1992 . . . . . .
. . .
54 1 1 1 2 02/09/1999 02/10/1999 . . . . . .
. . . . . . . . .
.
02/09/1999 04/13/2000 . . . . .
. . .
57 1 1 1 1 07/02/1999 . 1 18 01/14/1999 07/02/1999 1 16
07/01/1997 01/14/1997 1 4 01/01/1997 07/31/1997 . . .
.
07/08/1998 10/19/1999 . . . . .
. . .
73 3 1 1 4 01/18/2000 08/30/2000 1 4 12/01/1999 06/17/2000 1 4
12/01/1999 08/30/2000 1 4 12/01/1999 01/18/2000 3 3 11/22/1999
12/01/1999
01/20/1999 . 07/08/1996 01/28/1998 . . .
. . .
75 4 1 1 1 06/01/1999 . 1 18 05/25/1999 06/01/1999 . .
. . . . . . . . .
.
04/01/2001 . 11/03/1998 02/15/2000 08/14/1997 09/18/1997 12/13/1995
06/03/1997 04/21/1994 12/14/1994
76 1 1 . . . . . . . . . .
. . . . . . . . .
.
08/04/1998 . . . . . .
. . .
77 4 1 4 4 05/08/2001 . 4 4 12/11/1998 12/18/1998 . .
. . . . . . . . .
.
12/11/1998 . 10/10/1995 05/19/1997 03/17/1994 10/31/1994 .
. . .
80 2 1 2 4 03/31/1999 08/23/1999 2 4 02/10/1999 03/31/1999 . .
. . . . . . . . .
.
07/06/2000 . 12/29/1998 . 11/14/1997 05/04/1998 10/07/1992
. 07/20/1992 .
81 3 1 1 15 08/30/1999 09/08/1999 1 15 01/25/1999 02/08/1999 1 5
06/14/1996 12/31/2000 1 4 08/14/1997 11/06/1997 1 4 01/06/1997
01/21/1997
08/01/1988 . 01/01/1974 12/31/1975 . . .
. . .
82 1 1 1 4 07/27/2000 . 1 4 12/08/1998 02/17/2000 . .
. . . . . . . . .
.
12/04/1998 . . . . . .
. . .
83 1 1 1 18 09/17/1999 . 1 18 12/12/1997 . 1 4
04/29/1999 09/17/1999 . . . . . . .
.
04/03/2000 . 04/02/1999 . . . .
. . .
90 4 1 1 4 12/05/2000 . 1 7 11/22/2000 12/05/2000 1 4
08/23/2000 11/22/2000 1 7 08/14/2000 08/23/2000 2 4 07/11/2000
.
08/09/1999 . . . . . .
. . .
END DATA.
|