%let name=g3d; filename odsout '.'; data Measure; input x1 x2 y @@; datalines; -1.0 -1.0 15.54483570 -1.0 -1.0 15.76312613 -.5 -1.0 18.67397826 -.5 -1.0 18.49722167 .0 -1.0 19.66086310 .0 -1.0 19.80231311 .5 -1.0 18.59838649 .5 -1.0 18.51904737 1.0 -1.0 15.86842815 1.0 -1.0 16.03913832 -1.0 -.5 10.92383867 -1.0 -.5 11.14066546 -.5 -.5 14.81392847 -.5 -.5 14.82830425 .0 -.5 16.56449698 .0 -.5 16.44307297 .5 -.5 14.90792284 .5 -.5 15.05653924 1.0 -.5 10.91956264 1.0 -.5 10.94227538 -1.0 .0 9.61492010 -1.0 .0 9.64648093 -.5 .0 14.03133439 -.5 .0 14.03122345 .0 .0 15.77400253 .0 .0 16.00412514 .5 .0 13.99627680 .5 .0 14.02826553 1.0 .0 9.55700164 1.0 .0 9.58467047 -1.0 .5 11.20625177 -1.0 .5 11.08651907 -.5 .5 14.83723493 -.5 .5 14.99369172 .0 .5 16.55494349 .0 .5 16.51294369 .5 .5 14.98448603 .5 .5 14.71816070 1.0 .5 11.14575565 1.0 .5 11.17168689 -1.0 1.0 15.82595514 -1.0 1.0 15.96022497 -.5 1.0 18.64014953 -.5 1.0 18.56095997 .0 1.0 19.54375504 .0 1.0 19.80902641 .5 1.0 18.56884576 .5 1.0 18.61010439 1.0 1.0 15.86586951 1.0 1.0 15.90136745 ; run; data Measure; set Measure; x1sq = x1*x1; run; data pred; do x1=-1 to 1 by 0.1; do x2=-1 to 1 by 0.1; x1sq = x1*x1; output; end; end; run; proc tpspline data=measure; model y=x1 x1sq (x2); score data=pred out=predy; run; /* Duplicate the curve, a little lower - this has no real meaning, but is for demonstration purposes, to show how one might overlay 2 g3d contour surfaces in the same plot, using greplay. */ data predy; set predy; label p_y1='Predicted Value of y'; label p_y2='Predicted Value of y'; p_y1=p_y-8; p_y2=p_y+8; run; goptions device=png; goptions xpixels=600 ypixels=600; goptions border; ODS LISTING CLOSE; ODS HTML path=odsout body="&name..htm" (title="SAS/Graph g3d plot") style=htmlblue; goptions gunit=pct htitle=4.0 htext=2.5 ftitle="albany amt/bold" ftext="albany amt"; /* Generate the 2 plots, and save the grseg in name=, rather than displaying it. Make sure you plan things out so that the axes, labels, titles, etc are *exactly* the same in the 2 graphs, so they will overlay cleanly! */ goptions nodisplay; title1 ls=1.5 "Overlay Multiple G3D Surfaces, using Greplay"; /* If you overlay black anti-aliased text on top of black anti-aliased text, you can get a 'fuzzy' halo effect. Therefore make the first graph have white/background colored text, and then make the 2nd plot have black text. */ goptions ctext=white; proc g3d data=predy; plot x2*x1=p_y1 / grid zmin=0 zmax=30 xticknum=4 tile=80 ctop=purple cbottom=cx00ff00 name="plot1"; run; goptions ctext=black; proc g3d data=predy; plot x2*x1=p_y2 / grid zmin=0 zmax=30 xticknum=4 tile=80 ctop=blue cbottom=red name="plot2"; run; /* Now, greplay the 2 graphs together in the exact same position. */ goptions display; proc greplay tc=tempcat nofs igout=work.gseg; tdef WHOLE des="ENTIRE SCREEN TEMPLATE" 1/llx=0 lly=0 ulx=0 uly=100 urx=100 ury=100 lrx=100 lry=0 ; template = whole; treplay 1:plot1 1:plot2 des='' name="&name"; run; quit; ODS HTML CLOSE; ODS LISTING;