Programming the statistical procedures from SAS

Do mean calculation based on 2nd data time range

Reply
Occasional Contributor
Posts: 13

Do mean calculation based on 2nd data time range

Data1

time x y
11:00 2 3
11:03 4 5
11:07 10 30
12:00 30 20
12:03 21 4
..............

Data2
TimeStart TimeEnd
11:00 11:07
11:03 12:00
12:00 12:03
....................

Want to get results
TimeStart TimeEnd MeanX meanY
11:00 11:07 ? ?
11:03 12:00 ? ?
12:00 12:03 ? ?
............................
Frequent Contributor
Posts: 106

Re: Do mean calculation based on 2nd data time range

You could solve this programmatically by

a) putting DATA1 into a hash with TIME as key
b) iterate over DATA2 using both time values to find the relevant hash elements and doing the mean calculation

Others having SAS at their hands might chime in with some ready-to-use code.

(Note that this solution largely depends on the size of DATA1. If it is a very big dataset consider defining/using DATA1 as a dataset indexed on TIME).
Ask a Question
Discussion stats
  • 1 reply
  • 66 views
  • 0 likes
  • 2 in conversation