BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
YoloY
Calcite | Level 5

I specified the output path for the image, but the image was not saved in the file where I wanted to save it.

ods listing gpath="E:\程序" image_dpi=300 style=Journal;
ods graphics / imagename="Figure1" outputfmt=tiff width=10cm height=8cm border=off;
PROC TRAJ DATA=men OUT=out OUTPLOT=OP OUTSTAT=OS OUTEST=OE; 
id pe_id;
VAR var1 var2 var3; 
INDEP T1-T3; 
MODEL CNORM;
MIN 0; 
MAX 100; 
NGROUPS 1;
ORDER 4; 
RUN;
%trajplot(op, os ,"Men","Group 1","var","Exposure period (year)");
ods graphics off;

 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

I suspected this might be related to Proc Traj not being a SAS product and I think I am correct.

 

This line in the log

 

NOTE: 有 15884 个字节写入“C:\Users\hp\AppData\Local\Temp\SAS Temporary
Files\_TD14256_DESKTOP-O52JTF6_\gplot1.png”。

indicates that the file was created by Proc Gplot as Gplot1 is default first image file name created. The older graphs procs such as GPLOT do not use/recognize the GPATH setting which is for ODS graphics.

 

You would use the GOPTIONS statement to set properties for the graphs.

 

You would use something like this before executing the code that generates the plot.

 

filename graphout "E:\程序\Figure1.png";
goptions gsfname=graphout gsfmode=replace;

Caution: I have no idea what may be buried in the code for that %Trajplot macro. There may be GOPTIONS that will override the above.

So if you still do not get output in the expected file then turn on the OPTIONS MPRINT; before running the macro so you can see the code generated in the macro to see if it is setting GOPTIONS that are overriding yours. There might be documentation in the macro for setting the desired options.

 

 

View solution in original post

4 REPLIES 4
ballardw
Super User

The log should where the images were sent. Can you show us the LOG from running the code to see if we can make a suggestion.

YoloY
Calcite | Level 5

Thank you! The LOG from running the code as follows:

NOTE: No units specified for the HTITLE option. The current units associated with GUNIT will
be used.
NOTE: No units specified for the HTEXT option. The current units associated with GUNIT will be
used.

NOTE: 数据集 WORK.CPREDTMP 有 5 个观测和 1 个变量。
NOTE: “PROCEDURE CONTENTS”所用时间(总处理时间):
实际时间 0.00 秒
CPU 时间 0.00 秒

 

NOTE: 从数据集 WORK.CPREDTMP. 读取了 5 个观测
NOTE: “DATA 语句”所用时间(总处理时间):
实际时间 0.01 秒
CPU 时间 0.01 秒

 

NOTE: 正在删除 WORK.CPREDTMP (memtype=DATA)。

NOTE: “PROCEDURE DATASETS”所用时间(总处理时间):
实际时间 0.01 秒
CPU 时间 0.00 秒

 

NOTE: 从数据集 WORK.OS. 读取了 1 个观测
NOTE: 至少有一个 W.D 格式对于要打印的数字过小。可用“BEST”格式转换小数位。
NOTE: “DATA 语句”所用时间(总处理时间):
实际时间 0.00 秒
CPU 时间 0.00 秒

 

NOTE: 有 15884 个字节写入“C:\Users\hp\AppData\Local\Temp\SAS Temporary
Files\_TD14256_DESKTOP-O52JTF6_\gplot1.png”。

NOTE: 从数据集 WORK.OP. 读取了 3 个观测
NOTE: “PROCEDURE GPLOT”所用时间(总处理时间):
实际时间 0.45 秒
CPU 时间 0.37 秒

ballardw
Super User

I suspected this might be related to Proc Traj not being a SAS product and I think I am correct.

 

This line in the log

 

NOTE: 有 15884 个字节写入“C:\Users\hp\AppData\Local\Temp\SAS Temporary
Files\_TD14256_DESKTOP-O52JTF6_\gplot1.png”。

indicates that the file was created by Proc Gplot as Gplot1 is default first image file name created. The older graphs procs such as GPLOT do not use/recognize the GPATH setting which is for ODS graphics.

 

You would use the GOPTIONS statement to set properties for the graphs.

 

You would use something like this before executing the code that generates the plot.

 

filename graphout "E:\程序\Figure1.png";
goptions gsfname=graphout gsfmode=replace;

Caution: I have no idea what may be buried in the code for that %Trajplot macro. There may be GOPTIONS that will override the above.

So if you still do not get output in the expected file then turn on the OPTIONS MPRINT; before running the macro so you can see the code generated in the macro to see if it is setting GOPTIONS that are overriding yours. There might be documentation in the macro for setting the desired options.

 

 

YoloY
Calcite | Level 5
Your answer is very useful. Thank you very much.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 873 views
  • 0 likes
  • 2 in conversation