SAS EG带pass导出Excel
如何使用密码保护我的excel文件,因为在sas EG中不支持DDE 我正在使用这个,但是我没有convert.vbs,所以在哪里可以获得它SAS EG带pass导出Excel,sas,sas-macro,Sas,Sas Macro,如何使用密码保护我的excel文件,因为在sas EG中不支持DDE 我正在使用这个,但是我没有convert.vbs,所以在哪里可以获得它 /***********************************************/
/***********************************************/
/* Create a test worksheet to password protect */
/***********************************************/
ods tagsets.excelxp file="c:\temp.xml";
proc print data=sashelp.class;
run;
ods tagsets.excelxp close;
/*****************************************************************/
/* Create and excecute a script file using the input XML file */
/* and the converted XLSX file. The value 51 is needed for XLSX. */
/* Use the value of 1 for XLS files in the SaveAs command. */
/*****************************************************************/
%let XMLfile = c:\temp.xml;
%let ExcelFile = c:\temp.xlsx;
%let VBscript = ***c:\convert.vbs***;
%let password=test;
data _null_;
file "&vbscript" lrecl=200;
put 'Dim xlApp, xlWkb, SourceFile, TargetFile';
put 'Set xlApp = CreateObject("excel.application")';
put 'SourceFile="' "&XMLfile" '"';
put 'Set xlWkb = xlApp.Workbooks.Open(SourceFile)';
put 'TargetFile="' "&ExcelFile" '"';
put 'xlApp.DisplayAlerts=false';
put "xlWkb.SaveAs TargetFile, 51,""&password""";
put 'xlApp.DisplayAlerts=true';
put 'xlWkb.close';
run;
options noxwait noxsync;
x "cscript ""&vbscript""";
代码似乎为您创建了文件c:\convert.vbs,然后运行它。您只需删除星号,使其成为有效的文件路径。如果没有DDE,代码也不太可能适用于您 最后一行,
x "cscript ""&vbscript""";
是对操作系统的命令。通常,如果禁用DDE,也会禁用此类功能。您可以通过检查XCMD选项来检查这一点
proc options option=xcmd;
run;
如果启用了XCMD,您将看到:
XCMD在SAS中启用X命令
您只能在启动时更改该设置,有时还需要是管理员 更改%let VBscript=***c:\convert.vbs***;要%let VBscript=c:\temp\convert.vbs;然后重试。同时发布日志。您好,谢谢您的回答,但还是一样的。仅显示temp.xml,excel文件nothing.hello,XCMD在x命令中启用,日志为note writing tagsets.sasreport13egsr主体文件egsr是否已在计算机上安装excel?