Date: Mon, 10 Jan 2011 08:15:28 -0800
Reply-To: walden2000 <berrioscastellon@YAHOO.COM>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: walden2000 <berrioscastellon@YAHOO.COM>
Subject: Re: Flag Records in one file that meet criteria in records in
I apologize for doing a poor job describing my task. Let me try again,
I have a number of flights that were identified last month as chronically late
(by DOT standards). This is what I know about these flights:
1 – Airline
2 – Origen
3 – Destination
4 – Schedule departure time
The task is to identify the flights scheduled in a future month with:
1 – Airline
2 – Origen
3 – Destination
4 – Scheduled departure time within 30 minutes (plus or minus) of the Scheduled
departure time of the identified flight (previous month).
The list of flights on the previous month file has unique flights. Each data
record represents aggregated data about a flight.
The list of flights on the current a future month is structured such a way that
each data record represents one flight for one day.
This is what the files could look like:
CO MIA IAH 1215
CO MIA IAH 1745
RU IAH DFW 1458
and FILE2: (notice a date variable is included)
CO MIA IAH 1205 01/10/2011
CO MIA IAH 1220 01/11/2011
CO MIA IAH 1220 01/12/2011
RU IAH DFW 1045 01/10/2011
The task is to identify the flights on FILE2 that have a scheduled departure
time within 30 minutes of a flight identified on FILE1. Thank you for your
From: David Marso [via SPSSX Discussion]
To: walden2000 <firstname.lastname@example.org>
Sent: Sat, January 8, 2011 11:46:22 PM
Subject: Re: Flag Records in one file that meet criteria in records in another
Looks like MATCH FILES will be problematic.
Instead, Use ADD FILES and LAG to drag the target arrival time from the
"TABLE/CRITERIA" file into
the appropriate records.
Presuming both files are sorted by AIRLINE ORIG DEST ARRIVTIME.
ADD FILES / FILE ="TARGET"
/ IN =TARGET
/ FILE = "TESTDATA"
/ IN =TEST
/ BY AIRLINE ORIG DEST ARRIVTIME.
IF TARGET CHECKTIME=ARRIVTIME.
IF TEST CHECKTIME=LAG(CHECKTIME).
On Fri, 7 Jan 2011 13:50:47 -0800, walden2000 <[hidden email]> wrote:
>ThankÂ you for your prompt response.Â
>I seeÂ a small problem.Â The answer is NO toÂ theÂ key question.Â Â The records
>unique inÂ file1 -->Â Airline, Flight_Origin, Flight_Destination,
>Flight_Scheduled_Departure_Time.Â However, the match statement is by -->Â
>Airline Flight_Origin Flight_Destination.
>There is the possiblility of having more than one flight in file1 with the same
>Airline Flight_Origin Flight_Destination but different
>We could have a file1 that looks like this:
>CO MIA IAH 1215
>CO MIA IAH 1745
>RU IAH DFW 1458
>and a file2 that looks like this:
>CO MIA IAH 01/10/2011 1205
>CO MIA IAH 01/11/2011 1220
>CO MIA IAH 01/12/2011 1300
>RU IAH DFW 01/10/2011 1045
>Creating a conflict with the match command...
>Thank you for your help,
>From: Gene Maguin [via SPSSX Discussion]
>To: walden2000 <[hidden email]>
>Sent: Fri, January 7, 2011 12:51:30 PM
>Subject: Re: Flag Records in one file that meet criteria in records in another
>Ok. Much better! Thank you. A key question is whether there are multiple
>records in file1 with the same values for Airline, Flight_Origin,
>Flight_Destination, Flight_Scheduled_Departure_Time. I'll assume the answer
>is NO. If the answer is YES, then something different will need to be done.
>Then, the problem is just an 'add more variables to an existing file'
>problem. Some assumptions:
>1) File1 and file2 are sorted by the match variables.
>2) Flight_Scheduled_Departure_Time are both time values on a 24 hour clock.
>Match files file=file2/table=file1/rename=(Flight_Scheduled_Departure_Time=
>Â Â Flight_Scheduled_Departure_TimeFile1)/
>Â Â by Airline Flight_Origin Flight_Destination.
>Execute. /* Richard will disagree on an Execute here, I think.
>Â Â Flight_Scheduled_Departure_Time) le 30) flag=1.
>Do if (flag eq 1).
>Print / Airline Flight_Origin Flight_Destination Flight_Date
>Â Â Flight_Scheduled_Departure_Time.
>File1: Â Chronically delayed flights from previous month Â (about 64 records)
>File2: Scheduled flights from current or future month (about 80000 records)
>I need to flag the records on File2 with matching Airline, Flight Origin,
>Flight Destination and with a Flight_Scheduled_Departure_Time that is within
>30 minutes (+/-) of Flight_Scheduled_Departure_Time in File1.
>I was using a MATRIX but the arrays appear to loose their value once they
>exit the MATRIX. Â Any hints? Â Thank you,
>To manage your subscription to SPSSX-L, send a message to
>[hidden email] (not to SPSSX-L), with no body text except the
>command. To leave the list, send the command
>For a list of commands to manage subscriptions, send the command
>View message @
>To unsubscribe from Flag Records in one file that meet criteria in records in
>another file, click here.
>View this message in context:
>Sent from the SPSSX Discussion mailing list archive at Nabble.com.
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
For a list of commands to manage subscriptions, send the command
View message @
To unsubscribe from Flag Records in one file that meet criteria in records in
another file, click here.
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Flag-Records-in-one-file-that-meet-criteria-in-records-in-another-file-tp3331997p3335048.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.