Data visualization with SAS programming

Change in behavior of SAS/Graph using ODS HTML

Accepted Solution Solved
Reply
Trusted Advisor
Posts: 1,795
Accepted Solution

Change in behavior of SAS/Graph using ODS HTML

SAS 9.4 TS1M2, Windows 7 64 bit

 

Something has changed in the behavior of my SAS/Graph output to ODS HTML and I can't figure out what has changed. Perhaps you can point me in the right direction.

 

Previously, before this change in behavior, every graph I created would be sent (by default) to a catalog WORK.GSEG, or if I changed the default using the GOUT= option, for example, I could have the graphics written to catalog WORK.PAIGE. Now, the SAS/Graph output does not appear in any catalog, in fact WORK.GSEG is not created, nor is WORK.PAIGE created when I specifically request it to be created with the GOUT= option.

 

In addition, when I use the name= option on the plot statement, the previous behavior named the graphics output files (these are .png files) with whatever the name= option specified. Now, the graphics output files (the .png files) are created with the default names regardless of what I specify under name=, so if I use PROC GCHART, the output files are gchart.png, gchart1.png, etc.

 

Both before and after this change, the .html file, and the associated .png files, are created and can be viewed properly.

 

What's going on?


Accepted Solutions
Solution
‎04-07-2017 11:43 AM
SAS Super FREQ
Posts: 925

Re: Change in behavior of SAS/Graph using ODS HTML

The SAS/GRAPH product (GPLOT, GCHART, etc.) uses device-based graphics that are written to a catalog and then replayed. The ODS GRAPHIC system (which is part of BASE SAS) uses template-based graphics, which do not use any catalogs for graphics. For procedures such as CAPABILITY, which can produce both kind of graphics, the graphics type it produces depends on whether the ODS GRAPHICS system is ON or not. By default, it is ON. If you want to see the device-based graphic from CAPABILITY, you need to turn off ODS GRAPHICS:

 

ods graphics off;

 

PROC SGPLOT will produce ODS GRAPHICS output regardless of this setting, since that is the only type of output it can produce.

 

Hope this helps!

Dan

 

View solution in original post


All Replies
Trusted Advisor
Posts: 1,795

Re: Change in behavior of SAS/Graph using ODS HTML

As an example, take a look at this SAS code:

 

ods html file="report.html" path="&cdu\compare_chargeoffs" gpath="&cdu\compare_chargeoffs" style=sasweb;
proc gplot data=sashelp.class gout=paige;
    plot weight*height/name='oink';
run;
quit;

proc capability data=c.chargeoffs2 gout=paige;
    comphistogram originationyear/class=tapeyear name='spedc';
run;

proc sgplot data=c.chargeoffs2 ;
    scatter x=originationyear y=ltv/name='sss';
run;
ods html close;

The first PROC GPLOT on SASHELP.CLASS works exactly as it should, the plot is written to catalog PAIGE, and is named oink.

 

 

Next, PROC CAPABILITY is run on real data, and nothing is written to catalog PAIGE, and the .png file created is not named spedc.png, it is named histogram.png.

 

Next, PROC SGPLOT is run on real data, and nothing is written to catalog PAIGE, and the .png file created is not named sss.png, it is named sgplot.png.

 

You can see I haven't changed any options along the way.


Also, the SASLOG after PROC GPLOT contains

 

NOTE: 16217 bytes written to c:\users\eccrpm0\documents\compare_chargeoffs\oink.png.

as it should. The SASLOG after PROC CAPABILITY and PROC SGPLOT do not contain a similar line.

 

Solution
‎04-07-2017 11:43 AM
SAS Super FREQ
Posts: 925

Re: Change in behavior of SAS/Graph using ODS HTML

The SAS/GRAPH product (GPLOT, GCHART, etc.) uses device-based graphics that are written to a catalog and then replayed. The ODS GRAPHIC system (which is part of BASE SAS) uses template-based graphics, which do not use any catalogs for graphics. For procedures such as CAPABILITY, which can produce both kind of graphics, the graphics type it produces depends on whether the ODS GRAPHICS system is ON or not. By default, it is ON. If you want to see the device-based graphic from CAPABILITY, you need to turn off ODS GRAPHICS:

 

ods graphics off;

 

PROC SGPLOT will produce ODS GRAPHICS output regardless of this setting, since that is the only type of output it can produce.

 

Hope this helps!

Dan

 

Trusted Advisor
Posts: 1,795

Re: Change in behavior of SAS/Graph using ODS HTML

Yes, thanks @DanH_sas, I came to same conclusion a few days after I posted this.

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 199 views
  • 1 like
  • 2 in conversation