BookmarkSubscribeRSS Feed
Calcite | Level 5



I create a bunch of PROC G3Ds output that show very well in tagsets.rtf. When I try to place 4 of these graphs in one page via proc greplay, the colors disappear and just the silhouette of the graphs are shown.


Thank you very much for any advice.

Meteorite | Level 14

Can you post any sample code or sample output?

Calcite | Level 5

I will recreate the problem, and try to post it. thanks.



Super User
/*Try this statment.*/
ods graphics/outputfmt=png ;
proc greplay ..........
Calcite | Level 5
Thanks. I tried but couldn't recreate any of my greplay runs. I'll try again with your solution i the future.
Meteorite | Level 14

greplay is a bit tricky ... if you run your job multiple times in a SAS session, then you need to delete the grseg's from the prior run(s) so that you can re-use the same name, or you need to use different names for your grseg's each time you run it. (If you were bumping into this problem, then you were probably just seeing the graphs/colors from the first run, rather than the graphs/colors from the most recent run - just a theory!)


Calcite | Level 5

Thanks again. I made sure to eliminate whatever was there before hand. I believe that the problem is the device png. If I use it to generate individual graphs, they just look awful, as in the greplay. I'll delay this are until later when I have more time.


Thanks for your suggestions.





You might want to consider using ODS Graphics instead of the classic SAS/Graph procedures. If you can tell us what you're trying to create, we can give you some input using that approach.

Calcite | Level 5

Thanks, I'm generating a bunch of Proc G3d graphs and I wanted to put them in a trellis fashion, say 4 in one page, 2 X 2.


I know that proc template can do that, I never got to learn it completely. Thanks.




Super User

Can you at least show the code that you attempted that generates the silhouettes?

Also, what size were the original G3d graphs produced at? If you make an image that looks good at a full page, or close to it,  size and then use Greplay to do a 2x2 you are significantly reducing the image and thin lines, for example, can disappear because of the scale conversion.


Best would be to provide:

1) example data or use a SAS supplied data set from the SASHELP library

2) the code you use to create the G3d images

3) the code you attempted for Greplay.


Note that page orientation can also compress a dimension with Greplay.

I also remember having to design graphs for use with Greplay by modifying fonts to deal with rescaling as axis text would get warped.

Calcite | Level 5

Thanks for your extended note. I'm not attempting to do the greplay in this note.


My goptions:

I'm printinto into tagsets.rtf and the device actximg is the best for colors. See 3d graph at bottom.

MACROGEN(RPRT_BMI_PDP_3D): GOPTIONS reset = all device = actximg border xpixels = 600 ypixels =
400 nodisplay HTITLE = 12PT htext = 10pt vsize = 21cm hsize = 20cm colors = (blueviolet aquamarine
yellow white lightblue lightgreen yellow lightred white blueviolet lightblue aquamarine lightgreen
grey lightred lightyellow orangered red ) cback = black ;
MACROGEN(RPRT_BMI_PDP_3D): AXIS1 label = ( "OPTOM_PRESC" height = 3 font = "Arial/Bo" color =
yellow position = right ) value = (height = 2 color = yellow font = "Arial/Bo" ) ;
MACROGEN(RPRT_BMI_PDP_3D): AXIS2 label = ( "TOTAL_SPEND" height = 3 font = "Arial/Bo" color =
yellow justify = left ) value = (height = 2 font = "Arial/Bo" color = yellow) ;
MACROGEN(RPRT_BMI_PDP_3D): AXIS3 value = (height = 2 color = YELLOW font = "Arial/Bo" ) label =
("MODEL_PROB" height = 3 font = "Arial/Bo" justify = center color = yellow) ;


This is my g3d code


MACROGEN(RPRT_BMI_PDP_3D): PLOT rescaled_var1 * rescaled_var2 = MODEL_PROB / caxis = white ANNO =
NEWANNO zmin = 0 zmax = 1 GRID STYLE = 4 ctext = blue ctop = blue cbottom = YELLOW xaxis = axis2
yaxis = axis1 zaxis = axis3 zticknum = 5 xytype = 3 xticknum = 5 yticknum = 5 tilt = 55 rotate = 55
des ='' name = "G3D_1";
MACROGEN(RPRT_BMI_PDP_3D): title j = center color = white bcolor = darkblue font = helvetica BOLD
height = 12pt "4_2_1. BMI: Model Prob Projected on 'OPTOM_PRESC & TOTAL_SPEND'";
MACROGEN(RPRT_BMI_PDP_3D): title2 j = center color = white bcolor = darkred font = helvetica BOLD
height = 10pt "'M2_TRN_TREE' Resc. vars within [0; 1] Horiz. plane at 0.5";


My greplay, (which I'm not running at the moment, no time to get more headaches at the moment)

proc greplay /*gout = gcat.GSEG */ cc = clrmap /*igout = gcat.GSEG */ nofs
tc=sashelp.templt template=l2r2; /* provided, 2 boxes left, 2 boxes right */
device png /* win; */ ;
treplay 1:G3D_1 2:G3D_2 3:G3D_3 4:G3D_4;
/* treplay 1:g3d 2:gchart; does not find g3d and gchart i do not know why. */
run; quit;



Super User

I don't see a GOUT= option in your Proc G3D code. I would recommend explicitly naming the output catalog, probably in a permanent library so you don't need to rerun anything to reuse the images after getting the desired appearance. The default Work.Gseg may end up with way too many images and the names may surprise you. Then make sure the Greplay code uses the same Library.catalog name in the IGOUT= option.


After making sure that you know which catalog the images are written to you may want to look at the Goptions setting GOUTMODE.

The default is to Append and if you run your code multiple times during testing you get incremented names G3D_1 G3D_11  G3D_12 G3D_13 and likely the name may not match the result  you expect for your final image. After getting the code to generate the desired image I would set Goutmode=REPLACE, delete all the current items in the catalog and create a clean catalog with just the images I want. Then I know the names in the image.


Caveat: I always wanted a name that was bit more descriptive than the proc just to be sure which one I was looking for/at . Limit the name to 6 or 7 characters for simplicity. If using the ROTATE and TILT options to create multiple images I would look at fewer characters so the multiple image names are easier to predict. The stuff in documentation about GRSEG and use of names has always been a bit disconcerting and short names helped me when I was using the G3D, Gplot and Gchart procs to produce images for publication.


I never liked defining anything in PIXELS as they are device specific and may cause a variety of issues. Since you are already defining HSIZE and VSIZE I would be strongly tempted to remove the pixel definitions. Note that your 600 by 400 pixel definition does not scale well to 21cm by 20cm and just might be one of the issues.

Calcite | Level 5

Thank you very much. I tried the modifications that you mentioned, and I couldn't make it work.


I'm just tired of this exercise, I'll leave it for whenever I have more free time, if ever. The documentation is just not helpful.


Thanks again.





Super User

If you are attempting to do something using macros you didn't write I am not surprised. There can be so many changes needed and the macros can actually interfere in understanding what is going on.


There are reasons that most of the other graphics have been moved away from the device based procedures.


I remember spending a lot of time with very simple examples from the documentation and changing ONE thing at a time to see how the output was changed. Then repeating that when Greplay was involved starting from very simple examples.


If you can get the images stored as files, such as PNG there are other approaches than Greplay. The document layout options for PDF for example.


Note that there are multiple references to problems/limitations with Activex as well. I never used any of those related devices.

Calcite | Level 5

Thanks again. All my code is macros that I wrote, and it took me quite a bit of time to get the g3d and the colors that I wanted. But greplay is too much of an obsolete junk.


I'll have to try other softwares.











Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.


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
  • 17 replies
  • 5 in conversation