【发布时间】:2014-08-20 13:13:06
【问题描述】:
我不知道这是否是发布此帖子的正确位置,但在我看来,我更有可能在那里得到答案。
目前正在从事 SAS 实习工作,我正在尝试编写一个宏,以便自动执行为我的数据集寻找合适的 ARIMA 模型的过程。我对这个软件很陌生,而且不是统计学领域的专家。
但是,虽然我似乎了解如何导入文件并启动 proc arima,但我遇到了一个小问题。我的代码的一部分,如果我在宏之外编写它可以正常工作(我猜它被称为open code?)像这样:
data _null_;
set Lib.out; /* Lib.out contains the data of the OUTSTAT statement of the PROC ARIMA */
x = 1000000;
put _STAT_; /* Prints correctly the names of the different lines in the log */
if _STAT_='AIC' then do; /* _STAT_ is a column and AIC the name of a line AFAIK */
if _VALUE_ < x then
x = _VALUE_;
put x;
put _STAT_; /* Here only prints AIC, which I guess is correct inside of the IF loop */
end;
run;
但是当在宏中运行它时,例如:
%macro recherche(poste=, mto=);
--- code ---
data _null_;
set Lib.out; /* Lib.out contains the data of the OUTSTAT statement of the PROC ARIMA */
%let aic0 = 1000000;
%put _STAT_; /* Doesn't recognize the _STAT_ statement and stops */
%if _STAT_='AIC' %then %do;
%if _VALUE_ < &aic0 %then %do;
&aic0 = _VALUE_;
data Lib.chosen;
set Lib.model; /* Contains the OUTMODEL statement of PROC ARIMA */
run;
%end;
end;
run;
--- code ---
我试图在互联网上搜索类似的案例,但找不到我要查找的内容的解释。另外,作为 SAS 新手,官方文档仍然很难理解。提前致谢。
【问题讨论】: