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 (September 2003)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 17 Sep 2003 23:00:32 -0400
Reply-To:     Richard Ristow <wrristow@mindspring.com>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         Richard Ristow <wrristow@mindspring.com>
Subject:      Re: help joining two files by date
Comments: To: Isaac Dialsingh <consult@tstt.net.tt>
In-Reply-To:  <006e01c37d1c$93218670$04076cc8@HPDialsingh>
Content-Type: text/plain; charset="us-ascii"; format=flowed

At 09:06 AM 9/17/2003 -0400, Isaac Dialsingh wrote:

>I have two SPSS files. the first looks like the following where I can >have more than one case on a particular date: > > Case Date >1 20/2/98 >2 20/2/98 >3 21/2/98 >4 22/2/98 >5 22/2/98 >6 22/2/98 > >The other datafile has weather variables for each of the days. My >problem is this- I want to put the weather variables next to the date >in the original datafile by matching the data. Can anyone assist?

This is a classic use of the TABLE= parameter to MATCH FILES. This syntax (untested) assumes + File with several cases: . Your file with variables "Case" and "Date", and multiple records per day, is the SPSS working file. (It may contain any other variables as well, of course.) . "Date" is an SPSS date-format variable, and the file is in ascending order by date. (It may be in order by Case within Date, as well, but that is not required.) Use SORT CASES to make this so, if necessary. + Weather file: . The file with weather variables is c:\MY_SPSS\weather.sav. . The date in this file is named Date, and is an SPSS date variable (though it need not have the same display format as Date in the working file). . Each value of Date occurs at most once in the file. . The file is in ascending order by date. (If necessary, load the file, use SORT CASES, and re-save it.) . No variable names except Date occur in both files. (If this is not so, you'll need to use RENAME on your MATCH FILES.)

Then, it's easy:

MATCH FILES /FILE=* /TABLE='c:\MY_SPSS\weather.sav' /BY DATE.

The "TABLE=" causes the records in the file it names to be matched with all records in the first file whose keys match.

>Isaac


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