home *** CD-ROM | disk | FTP | other *** search
- Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
- Path: sparky!uunet!uvaarpa!darwin.sura.net!paladin.american.edu!auvm!SWIRL.MONSANTO.COM!GIBES
- Message-ID: <9301271827.AA15899@tin.monsanto.com>
- Newsgroups: bit.listserv.sas-l
- Date: Wed, 27 Jan 1993 12:27:48 -0600
- Reply-To: Kernon Gibes <gibes@SWIRL.MONSANTO.COM>
- Sender: "SAS(r) Discussion" <SAS-L@UGA.BITNET>
- From: Kernon Gibes <gibes@SWIRL.MONSANTO.COM>
- Subject: RE: merging animal and weather data
- Comments: To: SAS-L@uga.cc.uga.edu@tin.monsanto.com
- Comments: cc: GIBES@tin.monsanto.com
- Lines: 27
-
- Lisa Kriese (ansc413@unlvm) says, in part:
-
- > He has animal data with beginning and ending dates on trial. Some
- >animals will start on the same day, but most end on different days. In
- >another file he has daily weather information. He needs to find the
- >average weather information for each animal given their beginning and
- >ending dates (on average 3 months worth of weather data) on trial.
-
- Perhaps Howard S. can improve on the SQL approach given below. It
- assumes that the ANIMAL data set has just one observation per animal
- with separate variables for beginning and ending date (BEGDATE,
- ENDDATE). This could also be done with a variety of data step
- approaches, including using a SET WEATHER POINT= within a DO loop.
-
- Kernon Gibes
- Internet: gibes@swirl.monsanto.com
-
- /**
- ANIMAL has 1 obs/animal with ID, BEGDATE and ENDDATE
- WEATHER has 1 obs/date with DATE, TEMP
- **/
- proc sql;
- select mean(temp) as avetemp, id
- from weather, animal
- where date ge begdate and date le enddate
- group by id
- ;
-