Date: Tue, 21 May 2002 21:42:50 -0700
Reply-To: "Patrick E. Burns" <patrickburns@economicrt.org>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: "Patrick E. Burns" <patrickburns@economicrt.org>
Subject: Can SPSS handle "complex" DO REPEAT ... END REPEAT routines?
Content-Type: text/html; charset="us-ascii"
<html>
Dear SPSS'ers,<br><br>
<x-tab> </x-tab>I am
looking to do a complex DO REPEAT ... END REPEAT routine in SPSS syntax,
and am having difficulty. By complex, I mean more that one
"stand-in variable." This is roughly what my data looks
like:<br><br>
data list fixed /date_fr1 date_to1 date_fr2 date_to2 (etc., etc.). <br>
begin data.<br>
<font face="Courier, Courier">01/10/2001
06/24/2001
.
.<br>
.
.
.
.<br>
04/15/2000 07/10/2000
.
.<br>
11/25/2000 01/06/2001
.
.<br>
12/01/2001
.
12/02/2001 .<br>
09/17/2001
.
.
.<br>
11/27/2001
.
07/01/2001 08/31/2001<br>
04/06/2001
.
.
.<br>
.
.
.
.<br>
05/01/2000 05/15/2000
.
.<br>
.
.
.
.<br>
.
.
.
.<br>
06/06/2001 06/30/2001
09/01/1998 10/31/1999<br>
</font>END DATA. <br>
LIST.<br><br>
I would like to do the following - count up the number of days between
"From" - "To" date sets using this kind of
operation:<br><br>
COMPUTE days=CTIME.DAYS(date_to1 - date_fr1).<br>
FORMATS days (F3.0).<br>
VARIABLE WIDTH days (3). <br>
EXECUTE.<br><br>
Can the DO REPEAT ... END REPEAT command handle two or more input
variables in addition to the single output variable? Where is an
example of syntax that show how this is done? What I would like to
do is like this:<br><br>
DO REPEAT <br>
date1=date_fr1, date_fr2, etc <br>
/date2=date_to1, date_to2, etc <br>
/days=days1, days2, etc. <br><br>
COMPUTE new_dur=CTIME.DAYS(date2 - date1)/365.25.<br>
FORMATS new_dur (F3.0).<br>
VARIABLE WIDTH new_dur (3).<br>
END REPEAT. <br><br>
<x-tab> </x-tab>I'd
appreciate anyone who knows of example syntax that can do this kind of
"complex" DO REPEAT ... END REPEAT job.
Sincerely,<br><br>
PATRICK<br><br>
PS. If this is actually an easy problem, and you're still looking
for a challenge, I am looking to also only count the days computed above
that are within the last 12 months. Thus, how can I discount any
days in the "From" "To" sets that are before May
2001? Seems like I would need to subtract all of the
"From" dates from May 2001, and all of the "To" dates
from May 2002, and then compute the days on the sets that are still
valid...<br><br>
PPS. Thanks to the many persons who replied to my question last
week about creating age groups/bands.<br>
<x-sigsep><p></x-sigsep>
Patrick Burns, Senior Researcher<br>
Economic Roundtable<br>
315 West Ninth Street, Suite 1209<br>
Los Angeles, California 90015-4213<br>
<a href="http://www.economicrt.org/" eudora="autourl">http://www.economicrt.org</a><br><br>
</html>
|