其中“1”代表已分布,“0”代表未分布,现在以spec1为例,它现在Anhui、 Beijing、Guizhou有分布,求这些现有分布地区的气候极值,即temp、como、 wamo、 ffd、rain的MAX和MIN值,
即
If species=1,计算:
maxtemp=max(temp) and
mintemp=min(temp) and
maxcomo=max(como) and
mincomo=min(como) and
maxwamo=max(wamo) and
minwamo=min(wamo) and
maxffd=max(ffd) and
minffd=min(ffd) and
maxrain=max(rain) and
minrain=min(rain)
;并输出结果,标明“spec1的现有分布”。
第二步计算可能的分布区,即
if temp>=mintemp and temp<=maxtemp and
coldmo>=mincomo and coldmo<=maxcomo and
warmmo>=minwamo and warmmo<=maxwamo and
ffdays>=minffd and ffdays<=maxffd and
rain>=minrain and rain<=maxrain
;
最后输出结果,表明“spec1的可能分布”。
我已经苦想一个多月了,学了n多Sas入门之类的书籍,就是编不出来,请高手帮忙,再次谢谢了!作者: shiyiming 时间: 2006-4-13 03:17 标题: summary If I understand your question well, here is code for each of 180种植物(spec1-spec180).
proc sql;
create spec1 as
select prov, temp ,como ,wamo ,ffd ,rain ,spec1
from datasetname
where spec1=1 and
min(temp) <= temp <=max(temp) and
min(como) <= coldmo<=max(como) and
min(wamo) <= warmmo<=max(wamo) and
min(ffd) <= ffdays <=max(ffd) and
min(rain)<= rain<=max(rain);
quit;作者: shiyiming 时间: 2006-4-13 09:25 标题: zzz proc sql;
create table spec1 as
select prov, temp ,como ,wamo ,ffd ,rain ,spec1
from datasetname
where spec1=1
having min(temp) <= temp <=max(temp) and
min(como) <= como<=max(como) and
min(wamo) <= wamo<=max(wamo) and
min(ffd) <= ffd <=max(ffd) and
min(rain)<= rain<=max(rain);
quit;作者: shiyiming 时间: 2006-4-14 12:15 标题: 感谢大家! 非常感谢大家的帮忙,
我经过大家的帮助和刻苦学习,已经解决了问题,再次对大家的关怀与帮助表示感谢!作者: shiyiming 时间: 2006-4-15 23:32 标题: 请问? 。。。
having min(temp) <= temp <=max(temp) and
min(como) <= como<=max(como) and
min(wamo) <= wamo<=max(wamo) and
min(ffd) <= ffd <=max(ffd) and
min(rain)<= rain<=max(rain);
。。。
is there any possiblity that temp would be less than min(tem) or greater max(temp)? if not, "having clasue" is necessary?