home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / bit / listserv / sasl / 5793 < prev    next >
Encoding:
Text File  |  1993-01-28  |  1.6 KB  |  41 lines

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