SAS 从数据集读取,然后写入 Excel



下面是从数据集中读取一些数据,然后将数据写入excel文件的sas代码,但是,存在一些问题。

LIBNAME mck_pred "N:Data-Dumptesttraining" compress=yes;
proc sql;
create table temp as 
select cust_id, number from mck_pred.pred_data;
quit;
proc export data=temp output="C:Userstest.xlsx" dbms=XLSX replace;
run;

错误显示:

OTE: The SAS System stopped processing this step because of errors.
2463  proc export  data=temp output="C:Userstest.xlsx" dbms=XLSX replace;
------
22
76
ERROR 22-322: Syntax error, expecting one of the following: ;, (, DATA, DBLABEL, DBMS, DEBUG, FILE,
LABEL, OUTFILE, OUTTABLE, REPLACE, TABLE, _DEBUG_.
ERROR 76-322: Syntax error, statement will be ignored.
2464  run;

关于所示代码,我有三个问题:

  1. compress=yes是什么意思?
  2. 如何更改程序以使其成功运行?
  3. 我们什么时候应该在程序中使用quitrun

谢谢。

1)compress=yes表示您在库mck_pred中创建的新数据集将压缩其观测值。在此特定示例中,它没有影响。

3)长话短说,quitproc sql一起使用,rundata步骤和所有其他SAS程序一起使用。

2)输出路径的语法是outfile=,而不是output=。您还应该在proc export声明中提及dbms=xlsx

相关内容

最新更新