vb.net - How to run VB.NET with X command in SAS through Enterprise
问题描述
I am trying to use the following sas programs to convert multiple rtf files into pdf files by using the VB.NET (X command). It worked perfectly in PC sas. However, while using it in the SAS Enterprise, it gave no error message but didn't perform the pdf convertion.
Does anyone know what's happening in here? What should I do to make this work again? Thanks!
%macro vbs_pdf(rtfname=,pdfname=);
data _null_;
length vbscmd $ 400;
file "temp.vbs";
put 'Dim ObjWord';
put 'set objWord = CreateObject("Word.Application")';
put 'objWord.Visible = True';
vbscmd='objWord.Documents.Open("'|| "&rtfname" ||'")';
put vbscmd;
vbscmd='objWord.ActiveDocument.SaveAs "'||"&pdfname"||'", 17';
put vbscmd;
put 'objWord.ActiveDocument.Close(False)';
put 'objWord.Application.Quit(False)';
run;options noxwait;
data _null_;
command="START /WAIT CScript temp.vbs //NoLogo";
call system(command);
command2="DEL temp.vbs ";
call system(command2);
run;
%mend;
options noxwait;
data &prefix._toc;
set &prefix._toc;
call symput('count',compress(put(_n_,best.)));
run;
proc sql noprint;
select filename
into : rtf1- :rtf&count
from &prefix._toc;
run;
%macro cvtpdfs;
%do i=1 %to &count;
%let mypdf=%scan(&&rtf&i,1,'.');
%vbs_pdf(rtfname=&file2path./&&rtf&i,pdfname=&curpath/documents/pdf/&mypdf..pdf);
%end;
%mend;
%cvtpdfs;
解决方案
By default SAS EG has X commands disabled. In your SAS configuration files for EG you will see -NOXCMD
. You will see more here: https://blogs.sas.com/content/sasdummy/2009/11/19/using-the-x-and-systask-commands-from-sas-enterprise-guide/
推荐阅读
- text - 使用 ARKit 和 Vision(?) 替换真实世界的文本
- xml - 在动作脚本中通过关联 xml 进行交互的问题
- java - 在 Java 控制台中打印一行('\n' 的反面)
- c# - 使用 REST 的客户端证书问题
- android - 将数据从一个列表视图传递到另一个文本视图
- c# - 首先从 EF6 数据库中的 DbSet 获取外键字段
- android - ProgressBar 的进度在旋转或调整大小时显示错误
- wordpress - WordPress - 通过元数据获取评论?
- c++ - QSerialPort 中实际写入设备的字节数
- zsh - 当 Oh-my-ZSH 插件无法访问外部应用程序时如何隐藏终端警告