下面是从数据集中读取一些数据,然后将数据写入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;
关于所示代码,我有三个问题:
compress=yes
是什么意思?- 如何更改程序以使其成功运行?
- 我们什么时候应该在程序中使用
quit
和run
?
谢谢。
1)compress=yes
表示您在库mck_pred
中创建的新数据集将压缩其观测值。在此特定示例中,它没有影响。
3)长话短说,quit
与proc sql
一起使用,run
与data
步骤和所有其他SAS程序一起使用。
2)输出路径的语法是outfile=
,而不是output=
。您还应该在proc export
声明中提及dbms=xlsx
。