Data visualization with SAS programming

3d histogram questions

Posts: 1

3d histogram questions

I have been struggling with 3d histograms using proc template and sgrender.  I have 2 problems:

1) I can't seem to save the graph in true vector format (it will save with a .wmf extension but when opened, it is actually a bitmap)

2) I can't change the tick marks on the z axis. The higher tick marks are outside the data range, but I found documentation that said this wasn't a problem for linear axes only for time axes

here is my code:

proc template;

define statgraph bihistogram1;


      entrytitle " ";

      layout overlay3d / cube=false  tilt=55

            zaxisopts=(griddisplay=on linearopts=(tickvaluelist=(0 10 20 30 40 50 60 70 80 90 100)))


            yaxisopts=(linearopts=(tickvalueformat=yval.)) ;

      bihistogram3dparm x=value1 y=value2 z=percent/ display=all;





ods graphics on / imagefmt=wmf;

ods listing;

proc sgrender data=kdeplasma2 template=bihistogram1;

      label value1="x" value2="y" percent="Percent";

      title '3d plot of x vs y';


ods graphics off;

ods listing close;



Posts: 1,086

3d histogram questions

You are absolutely right on both counts. 

With SAS 9.2, all graphs are images embedded into EMF or PDF files.

With SAS 9.3, you will get scalable vector graphics output when you request a EMF or PDF output EXCEPT for cases where the graph cannot be rendered by simple vector graphics. This includes 3D graphs and graphs with color gradients and (for emf) transparencies. So in these cases you will get an embedded image. I don't know if we have a way around this yet even for future releases. You should also get a log message.

For 3D axes, you may have found a doc error.  For zaxisopts, we do not support TICKVALUEPRIORITY or VIEWMIN and VIEWMAX (like we do for 2D linear axes).  You can specify the tick values you want, but only the ones that are in the data range will be shown.  We do have plans to add these features in the next release.  The only way I can think you may be able to work around this would be to somehow overlay another fully transparent BiHistogram3DParm (or SurfacePlotParm) with data values up to the range you want. 

Ask a Question
Discussion stats
  • 1 reply
  • 2 in conversation