BookmarkSubscribeRSS Feed
LoremIpsum
Calcite | Level 5

I am running Base SAS 9.4 on Windows.  Opening a new session, I submit the following code:

  

/*ods listing close;*/

filename grafout "C:\output\sastest.png"; 
goptions reset=goptions device=png gsfname=grafout;

proc gchart data=sashelp.class;
   where sex="F";
   vbar age / sumvar=weight type=mean subgroup=age 
              nolegend discrete;
run; 
quit;

 

The file sastest.png is exported to the C:\output folder.  However, if I place an ods listing close;statement at the top of the code, the graph is no longer exported.

 

Apparently, the listing destination is more than "an ODS destination that produces traditional SAS output (monospace format)."

 

It is even more confusing because listing is turned off by default:

Beginning with SAS 9.3, by default, in the Windowing environment with the Windows and UNIX operating systems, the LISTING destination is closed and the HTML destination is open.

 

Why would the ods listing close; statement prevent the graph from exporting?

 

1 REPLY 1
Cynthia_sas
SAS Super FREQ

Hi, not many folks are using gsfname= option anymore. Some destination has to be open in order for GCHART to create output. The same thing is true of other SAS procedures too. IF ALL destinations are closed, then there are some procedures that will not produce output, even if you're asking for an image or a dataset.

 

  But, even if, for example, LISTING is closed -- you can get a PNG image created automatically if you were creating HTML output. Then a PNG file would be created automatically. For example,see the following example without GSFNAME just using ODS HTML.
cynthia

make_graf.png

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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
  • 1 reply
  • 964 views
  • 0 likes
  • 2 in conversation