Date: Wed, 17 Sep 2003 23:00:32 -0400
Reply-To: Richard Ristow <email@example.com>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Richard Ristow <firstname.lastname@example.org>
Subject: Re: help joining two files by date
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
>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:
The "TABLE=" causes the records in the file it names to be matched with
all records in the first file whose keys match.