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

时间:2015-03-12 01:02:39

标签: macros sas distribution

您好我在SAS Macro中使用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。

我在这个问题上花了两周时间。任何帮助都将得到真正的赞赏。

跟进,

以下是代码在我的工作计算机上完美运行时的日志,生成数据集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 **

谢谢!

1 个答案:

答案 0 :(得分:1)

由于ODS设置而发生此错误。 proc transreg可以生成绘图和数据。因为我想保存 proc transreg 生成的数据,所以我必须关闭ODS图形。

使用一行     ods graphics off; 在宏之前(或更改ODS注册表的设置)。

问题已经消失。

感谢大家的回复。