【问题标题】:How to fit a logarithmic line to multiple series in sgplot in SAS?如何将对数线拟合到 SAS sgplot 中的多个系列?
【发布时间】:2016-11-16 05:40:21
【问题描述】:

我在 sas 中有当前宏

%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;

这给了我结果:

我正在尝试将对数平均线添加到每个时间序列的图表中。我试图避免创建另一列对数平均值并绘制它们,而是希望有一个内置函数可以使用。

有人有这方面的经验吗?

【问题讨论】:

    标签: plot sas


    【解决方案1】:

    SAS 自 9.4 起内置了两个趋势线选项:

    • REG,基于多项式回归拟合回归趋势线(可以介于 0 度和 10 度之间,因此 1=线性 2=二次等)
    • LOESS,拟合 LOESS 平滑曲线(局部加权回归)

    请参阅the documentation for SGPLOT 了解更多信息。不幸的是,我不相信有任何东西可以像你在这里描述的那样跨多个系列工作。

    如果您从 SGPLOT 迁移到 GTL(图形模板语言),您也许可以做一些事情;在那里你可以在绘图过程中进行一些计算。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-12-09
      • 1970-01-01
      • 2020-03-18
      • 2016-08-09
      相关资源
      最近更新 更多