我希望根据每个人的独特开始和结束日期找到每个人的平均值z。曝光X对于每个位置每天都有很多值(实际上有23个位置,每个站点有超过300个值和日期):
NetworkInMessage_ReadArray()
数据集1中的个体按位置链接到数据集2:
//------------------------------------------------------------------------------
// <auto-generated />
//
// This file was automatically generated by SWIG (http://www.swig.org).
// Version 3.0.10
//
// Do not make changes to this file unless you know what you are doing--modify
// the SWIG interface file instead.
//------------------------------------------------------------------------------
所以,我想根据数据集2中指示的位置,从start_date到end_date为每个人最终得到valueZ的平均值。有人可以帮忙!
答案 0 :(得分:0)
这样的东西?
proc sql;
create table want as
select d1.individual
,d1.location
,avg(d2.valueZ) as avg_value
from dataset2 d2
join dataset1 d1
on d1.location=d2.location
and d2.date between d1.start_date and d2.end_date
group by d1.individual, d1.location
quit;