0
我正在計算年平均值和最高和最低溫度的標準偏差,。我的代碼如下:SAS PROC SQL計算平均值時出錯
PROC SQL;
create table new2 as
select date,SUM(max_temp) as max_temp,SUM(min_temp) as min_temp,
SUM(precip) as precip
from WORK.ROCH_DATA
group by date;
create table average2 as
select year(date) as year,(date) as year2,avg(max_temp) as maxavg,
avg(min_temp) as minavg, avg(precip) as avgprecip, std(max_temp) as
stdmaxtemp,
std(min_temp) as stdmintemp,std(precip) as stdprecip
from new2
group by year;
QUIT;
我的代碼最終吐在這樣的東西上;
它重複YEAR2和年份列(我只想要一個用正確的一年,即1916.1917),並保持了一年重新計算。我怎麼才能讓我看看我的數據中50年的單一計算? (即排除重新計算)
問題是這樣的代碼:'年(日期)爲一年,(日期)作爲year'。給兩列命名是沒有意義的。 –
我已經糾正了,但現在它提出了另一個問題。更新一個問題的時刻。 –
刪除您的第一個proc sql,並在您的work.ROCH表中指向第二個。 – Reeza