Desktop productivity for business analysts and programmers

SAS Code and ODS Graphics

Reply
Occasional Contributor
Posts: 18

SAS Code and ODS Graphics

I'm running EG4.1 on a Unix server. When I include ODS graphics statements within a SAS Code node, I never get the resulting files, whether PDF or HTML to provide any graphical output, regardless of the OPTIONS>RESULTS>GRAPH settings I use (java vs. activex vs etc.)

Yet, when I take my dataset and perform the exact same function node by node, the graphics work just fine in the resulting output.

For example:

ods graphics on ;
proc anova data=test ;
class group ;
model age=group ;
means group /tukey ;
run ;
ods graphics off ;

When I run this within the SAS Code node, I get the following error in the log:

NOTE: Unable to find the "GraphDataDefault" style element. Default style attributes will be used.
NOTE: Unable to find the "ThreeColorRamp" style element. Default style attributes will be used.
NOTE: Unable to find the "ThreeColorAltRamp" style element. Default style attributes will be used.
NOTE: Unable to find the "GraphFootnoteText" style element. Default style attributes will be used.
NOTE: Unable to find the "GraphDataText" style element. Default style attributes will be used.
Java class generated an exception.

I'm assuming that some setting isn't correct or a path is mis-specified but I can't figure it out. Any thoughts?

Sue
SAS Super FREQ
Posts: 8,819

Re: SAS Code and ODS Graphics

Hi:
I figure that with EG 4.1, you are probably also running SAS 9.1.3 on your server. The issue is that in SAS 9.1.3, there were really only 4 styles that were really tuned to work with ODS Graphics: styles.default, styles.journal, styles.statistical and styles.analysis (I'm pretty certain that was the list).

Your session is probably set to EGDEFAULT or some other style and those messages in the log are just telling you that your style template does not have all the style settings that ODS Graphics is expecting to find. So, try one of the 4 above (journal is black and white, statistical has some nice blue colors on a white background) -- and those messages should go away.

The other thing you may need to do is to explicitly put the ODS "sandwich" statements around your code:

[pre]
ods _all_ close;

ods html path='.' (url=none) gpath='.' (url=none)
file='myods.html' style=statistical;
ods pdf file='myods.pdf' style=journal;
ods graphics on ;
proc anova data=test ;
class group ;
model age=group ;
means group /tukey ;
run ;
ods graphics off ;

ods html close;
ods pdf close;

[/pre]

The reason you may want to put the specific ODS sandwich statements around
your code is that for HTML output, you need to specify the PATH= as well as the FILE= or else your HTML output can possibly get separated from the PNG file that gets built by ODS graphics.

For SAS 9.1.3, I'd recommend either ACTXIMG or JAVAIMG format for ODS GRAPHICS output. Or you can try this:
ods graphics on /imagefmt=staticmap;
if the interactive ActiveX or Java formats do not seem to come through. If you're still having problems after trying some of these suggestions, your next resource for help will be to open a help track with SAS Tech Support.

cynthia
Community Manager
Posts: 2,889

Re: SAS Code and ODS Graphics

Cynthia is correct about the style. EG uses EGDefault style by default, and you might have better luck with Journal or Statistical.

ODS graphics produce PNG files by default, even if your OPTIONS DEV= is set to ActiveX or Java. The graph image files are static (non-interactive) and are produced on the SAS server by the procedures themselves.

Chris
Occasional Contributor
Posts: 10

SAS Code and ODS Graphics

Greetings - I may have a similar problem.  I am trying to lever off http://support.sas.com/kb/41/776.html using the coordinates for a set of parkings spaces in a schematic of a parking lot for which I have data on utilization by space.  The idea is to replicate a project I did in R which creates a series of heat maps for various space utilization metrics.

The code works nicely - the spaces are drawn in the right places, etc.  The problem is that nothing I've tried has any useful influence on the color - I can't get anything other than a range of shades of a medium-light brown to white or a mess of several solid and numerous cross-hatched, etc., patterns after fiddling with REsults/Graphs options.

EG4.1, WinXP

Grateful for any hints.

Galen

PROC Star
Posts: 7,433

SAS Code and ODS Graphics

Possibly one of Robert Allison's examples might help: http://robslink.com/SAS/democd22/heatmap_info.htm

Occasional Contributor
Posts: 10

SAS Code and ODS Graphics

Many thanks - that is an interesting piece of code, but I am looking for a true heat map with a large number of (and automagically-determined) shades between red and green.

I ran my code on my work laptop (EG 4.3) and it works as intended, with 64 gradations of color.

Since EG4.1 expires in a week, I'll just chalk it up to a limitation of 4.1.

Many thanks again, Merry Christmas, and all that good stuff!

PROC Star
Posts: 7,433

SAS Code and ODS Graphics

Occasional Contributor
Posts: 10

SAS Code and ODS Graphics

Yep, I found that one and tried (unsuccessfully) to graft its tricks into my code.

I couldn't get that code to run, as-is, anyway, as it throws tons of errors.  I can't believe something rife with bad coding would be posted on SAS' own website, so the errors must be due to the absence of something on my system that the author assumes the user to have.

Does http://support.sas.com/kb/35/156.html run on your system?

I do have SAS/GRAPH available, according to _PRODSAVAIL

PROC Star
Posts: 7,433

Re: SAS Code and ODS Graphics

Yes.  I had to change the directory of the ouput file to an existing directory on my machine, but that is the only line I had to change.  I don't know if I can post a picture but, if I can, here is the final file I obtained:


result.JPG
Occasional Contributor
Posts: 10

SAS Code and ODS Graphics

Thanks for that tip.  I still can't get it to run on my EG4.1.SAS9.1 machine, I'll try again in a day or two on my work machine.  The DNA microarray is the sort of thing I'm trying to accomplish, only with yellow instead of black as the neutral color.

PROC Star
Posts: 7,433

SAS Code and ODS Graphics

You mentioned a critical number in your last post.  The code provided by SAS was made for SAS 9.2 thus could easily contain things that won't work on older versions.

Occasional Contributor
Posts: 10

SAS Code and ODS Graphics

http://support.sas.com/kb/35/156.html hangs on "template...unable to write to template store," so there's clearly something else I've not modified to work on my  computer, even under 9.3.  I do not have SAS/GRAPH, so maybe that's another problem.

Anyway, I'm going to forego the 9.3 bells and whistles and return to seeing what I can work out on my personal 9.1 version.  I've begun fiddling with this: http://support.sas.com/documentation/cdl/en/graphref/63022/HTML/default/viewer.htm#gr27n02-ex.htm , but without a great deal of luck so far.  I've found the same example in the 9.1 documentation, so I should be able to get something to work.

Thanks!

Occasional Contributor
Posts: 10

SAS Code and ODS Graphics

The first thing that I can't seem to control is the height and width of the area in gslide.  For example, if I change a couple of the y values to 110 or so (yes, a pointless shape, but please try it), a large part of the shape's area is off the graph entirely.  What options need I throw at gslide so that the graph area expands to include larger numbers?

Ask a Question
Discussion stats
  • 12 replies
  • 445 views
  • 0 likes
  • 5 in conversation