BookmarkSubscribeRSS Feed
hellohere
Pyrite | Level 9

The code is from the link below.

Solved: Re: How to save out PLOT/Picture explicitly?! - SAS Support Communities

 

Somehow, I run and did not see the picture file. The file location seems alright. 

 

ods _all_ close;
options nodate nonumber;
options papersize=(7.35in 5.40in);
options leftmargin="0.001in" rightmargin="0.001in";
title;
ods printer printer=png file="e:\temppic\composite.png";
ods layout gridded columns=2 rows=2 advance=proc
    column_gutter=0.1in row_gutter=0.1in;
ods graphics / width=3.5in;
proc sgplot data=sashelp.applianc(where=(cycle<=20));
scatter y=units_1 x=cycle;
run;
proc sgplot data=sashelp.applianc(where=(cycle<=20));
scatter y=units_2 x=cycle;
run;
proc sgplot data=sashelp.applianc(where=(cycle<=20));
scatter y=units_3 x=cycle;
run;
proc sgplot data=sashelp.applianc(where=(cycle<=20));
scatter y=units_4 x=cycle;
run;
ods layout end;


9330  ods layout end;
9331  ods _all_ close;
NOTE: ODS PRINTER printed 1 page to C:\Users\Lenovo\composite.png.
9332  options nodate nonumber;
9333  options papersize=(7.35in 5.40in);
9334  options leftmargin="0.001in" rightmargin="0.001in";
9335  title;
9336  ods printer printer=png file="e:\temppic\composite.png";
NOTE: Writing ODS PRINTER output to DISK destination "e:\temppic\composite.png", printer "PNG".
9337  ods layout gridded columns=2 rows=2 advance=proc
9338      column_gutter=0.1in row_gutter=0.1in;
9339  ods graphics / width=3.5in;
9340  proc sgplot data=sashelp.applianc(where=(cycle<=20));
9341  scatter y=units_1 x=cycle;
9342  run;

NOTE: PROCEDURE SGPLOT used (Total process time):
      real time           0.31 seconds
      cpu time            0.09 seconds

NOTE: There were 20 observations read from the data set SASHELP.APPLIANC.
      WHERE cycle<=20;

9343  proc sgplot data=sashelp.applianc(where=(cycle<=20));
9344  scatter y=units_2 x=cycle;
9345  run;

NOTE: PROCEDURE SGPLOT used (Total process time):
      real time           0.16 seconds
      cpu time            0.01 seconds

NOTE: There were 20 observations read from the data set SASHELP.APPLIANC.
      WHERE cycle<=20;

9346  proc sgplot data=sashelp.applianc(where=(cycle<=20));
9347  scatter y=units_3 x=cycle;
9348  run;

NOTE: PROCEDURE SGPLOT used (Total process time):
      real time           0.15 seconds
      cpu time            0.04 seconds

NOTE: There were 20 observations read from the data set SASHELP.APPLIANC.
      WHERE cycle<=20;

9349  proc sgplot data=sashelp.applianc(where=(cycle<=20));
9350  scatter y=units_4 x=cycle;
9351  run;

NOTE: PROCEDURE SGPLOT used (Total process time):
      real time           0.12 seconds
      cpu time            0.00 seconds

NOTE: There were 20 observations read from the data set SASHELP.APPLIANC.
      WHERE cycle<=20;

9352  ods layout end;
2 REPLIES 2
hellohere
Pyrite | Level 9

BUT  if just the top line, one more time, the pic is popped out?!

 

9375  ods _all_ close;
NOTE: ODS PRINTER printed 1 page to e:\temppic\composite.png.

WHy?

Kurt_Bremser
Super User
Because the png file is only created when the PRINTER destination is closed. ODS CLOSE statements should always be part of any code where an ODS destination is opened.

CFC_SAS_Communities_400x225.jpg

Call for content now open!

It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.

Submit your proposal →

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 56 views
  • 0 likes
  • 2 in conversation