2016-11-15 17 views
0

我在SAS如何在SAS中的sgplot中將對數行擬合爲多個系列?

%macro Plot_Rolling_Avgs(id, ylabel_, xlabel_, title_, avg_1, avg_2, avg_3, avg_4, avg_5, avg_6); 
proc Sgplot data=VA_PUR_Cur_Cur_Roll; 
SERIES X = &id Y = &avg_1; 
SERIES X = &id Y = &avg_2; 
SERIES X = &id Y = &avg_3; 
SERIES X = &id Y = &avg_4; 
SERIES X = &id Y = &avg_5; 
SERIES X = &id Y = &avg_6; 
YAXIS LABEL = &ylabel_; 
XAXIS LABEL = &xlabel_; 
Title &title_; 
keylegend/location=inside position=topleft across=1; 

ods graphics on/
    width=15.0in 
    height=5.0in; 
run;                                  
quit;  
%mend Plot_Rolling_Avgs; 

這給了我結果目前宏: enter image description here

我想數平均線添加到圖表爲每個時間序列。我試圖避免創建另一列對數平均值並繪製這些列,而是希望有一個內置函數可供使用。

有沒有人有這方面的經驗?

回答

0

SAS具有作爲9.4,二趨勢線選項內置於:

  • REG,其適合基於多項式迴歸迴歸趨勢線(可以具有beween 0和10度,使1 =線性2 =二次等)
  • 黃土,其嵌合的黃土平滑的曲線(這是一個局部加權迴歸)

更多信息參見the documentation for SGPLOT。不幸的是,我不相信像你在這裏描述的那樣有任何跨多個系列的作品。

如果您從SGPLOT移至GTL(圖形模板語言),您可能會做某些事情;那裏你可以在繪圖過程中進行一些計算。

相關問題