为什么我不能按预期将图表保存到指定文件?有人可以帮我解决这个问题吗?非常感谢。
祝你好运, 祢
%macro Corr(in,out,y,x,separateBy,titleString,xSize=900pt,ySize=600pt,saveDestination="c:\sas graph",saveResolution=400);
goptions reset=all hsize=&xSize vsize=&ySize;
ods graphics on;
ods listing gpath=&saveDestination image_dpi=&saveResolution;
ods graphics / imagename='Repeat' imagefmt=jpeg;
proc reg data=&in outest=&out simple edf;
title "&titleString of #ByVal(_name_)";/*Double quotation required when macro variable present in title string*/
model &y=&x / alpha=0.05 noprint;
id bladeSerialNumber;
by &separateBy;
plot &y*&x;
run;
quit;
ods graphics off;
title '';
%mend;
*Invoke Example;
libname ro 'c:\sas output\ro';
%corr(ro.SUMMARY_SPLITBYITERATION_METHOD1,corrSummary,Iter2,Iter1,_name_,Repeatability);
以下是SAS的部分说明:
%corr(ro.SUMMARY_SPLITBYITERATION_METHOD1,corrSummary,Iter2,Iter1,_name_,Repeatability);
WARNING: The variable _NAME_ or _TYPE_ exists in a data set that is not TYPE=CORR, COV, SSCP, etc.
NOTE: Graph's name, REG, changed to REG384. REG is already used or not a valid SAS name.
NOTE: Graph's name, REG, changed to REG112. REG is already used or not a valid SAS name.
NOTE: 29844 bytes written to C:\Users\mzhou7165825\AppData\Local\Temp\SEG8728\SAS Temporary Files\_TD9196_5K82J12A_\Prc2\reg384.png.
ERROR: Insufficient authorization to access C:\windows\system32\sasgraph.png
NOTE: The above message was for the following BY group:
NAME OF FORMER VARIABLE=Amplitude10LVGA
NOTE: Graph's name, REG, changed to REG385. REG is already used or not a valid SAS name.
NOTE: Graph's name, REG, changed to REG113. REG is already used or not a valid SAS name.
答案 0 :(得分:0)
首先请确保saveDestination="c:\sas graph"
指向现有文件夹,并为输出分配文件名。
检查:
第二,如果第一个句子评估为false(并且sas在本地运行),则创建具有所需用户访问权限的文件夹。
但是,如果您远程运行sas,则无法写入本地计算机,只能写入服务器。对于Windows服务器,您可以使用以下语法来保存文件:
[code start]
%let mypath = C:\Users\%sysfunc(dequote(&_CLIENTUSERID))\Documents\;
此
ods pdf file= "&mypath\yourfile.pdf";
或者
ods listing gpath = "&mypath\yourfile.jpeg";
*** your code***
ods _all_ close;
[code end]