SAS:使用PROC TRANSREG时,ODS不生成boxcox

SAS: when using PROC TRANSREG, ODS does not generate boxcox

您好,我正在 SAS 宏中使用 proc transreg。

代码如下,

  %if &cnt_amt>0 %then %do;
    ods output boxcox=boxcox; 

    proc transreg data=data0; 
      where &response>0;
      model BoxCox(&response / lambda=0.05 to 1 by 0.05) = identity(&vars_amt);
      run;

    data _null_;
      set boxcox;
      if ci='<';
      call symput ('lambda',lambda);
      run;

  %end; /* %if cnt_amt>0 ... */
  %else %let lambda=0.4;

当我 运行 我的工作计算机上的代码时,代码 运行 非常好并且没有给我任何错误消息。但是,当我 运行 在我的个人笔记本电脑上编写代码时,代码会给我一条错误消息,并且不会生成数据集 work.boxcox。

我已经在这个问题上花了两周时间。任何帮助将不胜感激。

跟进,

这是代码在我的工作计算机上运行ning完美时的日志,生成了数据集boxcox

MPRINT(MIXTRAN):   ods exclude all ;
MPRINT(MIXTRAN):   ;
MPRINT(MIXTRAN):   ** ods exclude all ;
MPRINT(MIXTRAN):   ods exclude all ;
MPRINT(MIXTRAN):   ;
MPRINT(MIXTRAN):   ** ods exclude all ;
SYMBOLGEN:  Macro variable TITLES resolves to 4
MPRINT(MIXTRAN):   title5 "Starting Estimates for Amount Model" ;
SYMBOLGEN:  Macro variable LAMBDA resolves to
MLOGIC(MIXTRAN):  %IF condition &lambda eq  is TRUE
SYMBOLGEN:  Macro variable CNT_AMT resolves to 2
MLOGIC(MIXTRAN):  %IF condition &cnt_amt>0 is TRUE
MPRINT(MIXTRAN):   ods output boxcox=boxcox;
NOTE: There were 872 observations read from the data set WORK._PERSONS.
NOTE: The data set WORK._PERSONS has 872 observations and 8 variables.
NOTE: PROCEDURE SORT used (Total process time):
  real time           0.04 seconds
  cpu time            0.03 seconds


MPRINT(MIXTRAN):   proc transreg data=data0;
SYMBOLGEN:  Macro variable RESPONSE resolves to totaldfe
MPRINT(MIXTRAN):   where totaldfe>0;
SYMBOLGEN:  Macro variable RESPONSE resolves to totaldfe
SYMBOLGEN:  Macro variable VARS_AMT resolves to WEEKEND SEQORDER
MPRINT(MIXTRAN):   model BoxCox(totaldfe / lambda=0.05 to 1 by 0.05) =     identity(WEEKEND
SEQORDER);
MPRINT(MIXTRAN):   run;

**NOTE: The data set WORK.BOXCOX has 20 observations and 7 variables.**
NOTE: There were 936 observations read from the data set WORK.DATA0.
  WHERE totaldfe>0;
NOTE: PROCEDURE TRANSREG used (Total process time):
  real time           0.08 seconds
  cpu time            0.04 seconds

这是代码在我的笔记本电脑上 运行 不正常时的日志。未生成数据集boxcox

MPRINT(MIXTRAN):   ** ods exclude all ;
SYMBOLGEN:  Macro variable TITLES resolves to 4
MPRINT(MIXTRAN):   title5 "Starting Estimates for Amount Model" ;
SYMBOLGEN:  Macro variable LAMBDA resolves to
MLOGIC(MIXTRAN):  %IF condition &lambda eq  is TRUE
SYMBOLGEN:  Macro variable CNT_AMT resolves to 2
MLOGIC(MIXTRAN):  %IF condition &cnt_amt>0 is TRUE
MPRINT(MIXTRAN):   ods output boxcox=boxcox;
NOTE: There were 872 observations read from the data set WORK._PERSONS.
NOTE: The data set WORK._PERSONS has 872 observations and 8 variables.
NOTE: PROCEDURE SORT used (Total process time):
  real time           0.03 seconds
  cpu time            0.03 seconds


MPRINT(MIXTRAN):   proc transreg data=data0;
SYMBOLGEN:  Macro variable RESPONSE resolves to totaldfe
MPRINT(MIXTRAN):   where totaldfe>0;
SYMBOLGEN:  Macro variable RESPONSE resolves to totaldfe
SYMBOLGEN:  Macro variable VARS_AMT resolves to WEEKEND SEQORDER
MPRINT(MIXTRAN):   model BoxCox(totaldfe / lambda=0.05 to 1 by 0.05) =     identity(WEEKEND SEQORDER);
MPRINT(MIXTRAN):   run;

NOTE: There were 936 observations read from the data set WORK.DATA0.
  WHERE totaldfe>0;
NOTE: PROCEDURE TRANSREG used (Total process time):
  real time           0.10 seconds
  cpu time            0.03 seconds

** 未生成数据集boxcox **

谢谢!

这个错误是由于 ODS 设置造成的。 proc transreg 可以生成绘图和数据。因为我要保存proc transreg生成的数据,所以必须关闭ODS图形。

使用一行 ods图形关闭; 在宏之前(或更改 ODS 注册表的设置)。

问题解决了。

谢谢大家的回复。