LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (January 2011)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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
              another file
In-Reply-To:  <201101090543.p08BoGi2022035@wasabi.cc.uga.edu>
Content-Type: multipart/alternative;

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:   Same: 1 – Airline 2 – Origen 3 – Destination and, 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:   FILE1: 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 help.      Enrique Berrios  

________________________________ From: David Marso [via SPSSX Discussion] <ml-node+3333621-1660806986-147408@n5.nabble.com> To: walden2000 <berrioscastellon@yahoo.com> Sent: Sat, January 8, 2011 11:46:22 PM Subject: Re: Flag Records in one file that meet criteria in records in another file

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). HTH, David ---

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 >are > >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 >Flight_Scheduled_Departure_Time. > >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, > >Enrique Berrios >Houston, Texas > > > > >________________________________ >From: Gene Maguin [via SPSSX Discussion] ><[hidden email]> >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 >file > >Hi Enrique, > >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. > >Compute flag=0. >If (abs(Flight_Scheduled_Departure_TimeFile1- >  Â 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. >End if. >Execute. > > > > > >Given: > >File1:  Chronically delayed flights from previous month  (about 64 records) >Airline >Flight_Origin >Flight_Destination >Flight_Scheduled_Departure_Time > >File2: Scheduled flights from current or future month (about 80000 records) >Airline >Flight_Origin >Flight_Destination >Flight_Date >Flight_Scheduled_Departure_Time > >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 >SIGNOFF SPSSX-L >For a list of commands to manage subscriptions, send the command >INFO REFCARD > > >________________________________ > >View message @ >http://spssx-discussion.1045642.n5.nabble.com/Flag-Records-in-one-file-that-meet-?by-user=tcriteria-in-records-in-another-file-tp3331997p3332314.html > > >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-?by-user=t in-one-file-that-meet-criteria-in-records-in-another-file-tp3331997p3332516.html

>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 SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD

________________________________

View message @ http://spssx-discussion.1045642.n5.nabble.com/Flag-Records-in-one-file-that-meet-criteria-in-records-in-another-file-tp3331997p3333621.html

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.


[text/html]


Back to: Top of message | Previous page | Main SPSSX-L page