Data visualization with SAS programming

Within SAS/EG, saving SAS/Graph proc gplot as gif to named filename ?

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 5
Accepted Solution

Within SAS/EG, saving SAS/Graph proc gplot as gif to named filename ?

I've recently moved to the SAS/EG environment to submit my SAS jobs.   I'd like save my proc gplots (SAS/Graph) to a named GIF (or JPEG) filename in a specific local directory so I can use them later in a custom web app.

 

I cannot figure out how to do this.  proc gplot in SAS/EG seems to ignore gsfname=.   I think it's because it's wrapped in ODS.

 

Should I switch to proc sgplot and use ODS (I'm not familiar with this method)?

Or is there a way in SAS/EG to use SAS/Graph and redirect the output to a named gif filename?

Thanks,

Steve

 

 

 

* this doesn not make gif chart at the named filename;

filename graphout "&dir0\brs_m29.gif";

goptions gsfname=graphout gsfmode=replace device=gif;

proc gplot data=freq03;

  plot percent * yq = finalrating / grid ;

  run;

  quit;

 


Accepted Solutions
Solution
‎11-09-2015 10:47 AM
Esteemed Advisor
Esteemed Advisor
Posts: 6,697

Re: Within SAS/EG, saving SAS/Graph proc gplot as gif to named filename ?

Hi,

 

I don't use EG so just guessing here, but if it is ods then you could put before your code:

ods _all_ close;

That would turn off all destinations.  You may also want to check what the &dir0 represents and if SAS has access to it.

View solution in original post


All Replies
Solution
‎11-09-2015 10:47 AM
Esteemed Advisor
Esteemed Advisor
Posts: 6,697

Re: Within SAS/EG, saving SAS/Graph proc gplot as gif to named filename ?

Hi,

 

I don't use EG so just guessing here, but if it is ods then you could put before your code:

ods _all_ close;

That would turn off all destinations.  You may also want to check what the &dir0 represents and if SAS has access to it.

SAS Employee
Posts: 170

Re: Within SAS/EG, saving SAS/Graph proc gplot as gif to named filename ?

[ Edited ]

Basically the following:

filename graphout "c:\";

goptions reset=all device=gif gsfname=graphout;

ODS _all_ CLOSE;

ODS LISTING;

proc gplot data=freq03;

plot percent * yq = finalrating / grid name="m29";

run;

quit;

ODS LISTING CLOSE;

 

Occasional Contributor
Posts: 5

Re: Within SAS/EG, saving SAS/Graph proc gplot as gif to named filename ?

Adding ods_all_close; was part of it.

I then needed to turn on "ods listing;"    I don't fully understand it, but those two lines (47 & 48 below) did it for me.  

 

 

 

47         ods _all_ close;
48         ods listing;
49         
50         
51         filename graphout "&dir0\brs_m29.gif";
52         goptions gsfname=graphout gsfmode=replace device=gif;
53         
54         proc gplot data=freq03;
55         plot percent * yq = finalrating / grid  ;
56         run;

NOTE:  101 records written to \\sassrvr\shared\users\steve\BRS\brs_m29.gif
57         quit;

 

 

 

 

   

Post a Question
Discussion Stats
  • 3 replies
  • 287 views
  • 0 likes
  • 3 in conversation