ods excel 和 proc 模板

ods excel and proc template

在通过 ods template 定义名为 excel 的样式后尝试使用 ods excel 时,我 运行 遇到了一个错误。我想知道是否有人可以解释为什么会发生这种情况,因为我认为 ods 样式和 ods 目的地是两个完全不同的东西。

以下 ods excel 语句工作正常:

ods excel file="%sysfunc(pathname(work))\x.xlsx";
proc print data=sashelp.class;
run;
ods excel close;

但是如果我在 运行 执行下面的 proc template 代码后尝试 运行 它,我会得到一个错误。

proc template;
  define style excel; 
    parent=styles.htmlblue;
    class graph       / attrpriority='none';
    style graphdata1  / contrastColor=#416FA6 markersymbol='circlefilled';
    style body from body / pagebreakhtml=_undef_; * REMOVE THE HORIZONTAL RULE;
  end; 
run; 

ods excel file="%sysfunc(pathname(work))\x.xlsx";
proc print data=sashelp.class;
run;
ods excel close;

错误是:

ERROR: Could not find method.
ERROR: No body file. EXCEL output will not be created.

我可以将我的样式重命名为 excel 以外的名称来解决这个问题,但我不明白为什么会发生这种情况。有人能解释一下吗?谢谢。

来自评论,感谢@Tom:

使用ods styles.excel代替ods excel

ods styles.excel file="%sysfunc(pathname(work))/x.xlsx";
proc print data=sashelp.class;
run;
ods styles.excel close;