Dataset "A" is coded like this:
ID AREA YEAR START FINISH
541 3 2006 172 211
542 3 2006 . .
543 3 2006 145 182
544 3 2006 121 167
545 3 2006 153 187
546 3 2006 171 204
547 3 2006 132 173
548 3 2006 . .
549 3 2006 129 167
550 3 2006 192 225
551 3 2006 110 .
552 3 2006 150 187
553 3 2006 . .
554 3 2006 168 .
555 3 2006 193 227
Dataset "B" is coded like this:
AREA DAY YEAR H_TEMP L_TEMP M_TEMP PRECIP
2 104 2003 78 40 59 0
2 105 2003 84 60 72 0
2 106 2003 82 33 57.5 0
2 107 2003 38 32 35 0.06
2 108 2003 42 35 38.5 0.31
2 109 2003 71 40 55.5 0.01
2 110 2003 73 58 65.5 0.24
2 111 2003 71 46 58.5 0.06
2 112 2003 48 33 40.5 0.03
2 113 2003 57 28 42.5 0
2 114 2003 64 33 48.5 0
2 115 2003 65 39 52 0
2 116 2003 60 31 45.5 0
2 117 2003 74 36 55 0
2 118 2003 78 55 66.5 0
2 119 2003 78 37 57.5 0
2 120 2003 64 46 55 0.13
2 121 2003 52 45 48.5 1.11
2 122 2003 51 42 46.5 0.02
2 123 2003 56 32 44 0
2 124 2003 64 31 47.5 0
2 125 2003 64 49 56.5 0.58
2 126 2003 63 49 56 0
2 127 2003 62 48 55 0.08
2 128 2003 63 46 54.5 0.01
As far as output goes I'm envisioning a dataset "C"with the following variables:
ID - individual nesting attempt identifier from dataset "A"
YEAR - coincides with both dataset "A" and "B"
AREA - coincides with both dataset "A" and "B"
min_H_TEMP - calculated (see below for how)
mean_H_TEMP - calculated (see below for how)
max_H_TEMP - calculated (see below for how)
min_L_TEMP - calculated (see below for how)
mean_L_TEMP - calculated (see below for how)
max_L_TEMP - calculated (see below for how)
min_M_TEMP - calculated (see below for how)
mean_M_TEMP - calculated (see below for how)
max_M_TEMP - calculated (see below for how)
sum_PRECIP - calculated (see below for how)
Each sample in dataset "A" has a unique identifier (ID) and a start (START) and an end (FINISH) date associated with a specific year of the study (YEAR) and a study area (AREA).
Dataset "B" has corresponding YEAR, AREA, and DAY (related to START and FINISH) information for weather variables (H_TEMP, L_TEMP, M_TEMP, and PRECIP).
I need to figure out how to write SAS code to use dataset "A" to find START and FINISH dates for an individual nesting attempt identified by ID, YEAR, and AREA and then take those values and calculate based on dataset "B" the min, max and mean H_TEMP, L_TEMP, and M_TEMP as well as the sum of all precipitation (PRECIP) for the specified interval (START->FINISH) at the same AREA in the same YEAR as the nesting attempt (ID) from dataset "A".
Here's an example from above starting in dataset "A" with this information:
ID=546
START=171
FINISH=204
AREA=3
YEAR=2006
For this sample I would need the mean, min, and max H_TEMP, L_TEMP, and M_TEMP and sum of PRECIP calculated for the interval starting on 171 and ending on 204 from dataset "B" for 2006 at area 3.
Hopefully this additional information helps,
Tim