I want to use PROC TEMPLATE to produce a 3D graphic of a surface. I have the following definition, which works properly:
proc template ;
define statgraph surfaceplot ;
begingraph ;
layout overlay3d / cube=false xaxisopts=( griddisplay=on ) yaxisopts=( griddisplay=on ) zaxisopts=( griddisplay=on ) ;
surfaceplotparm x=y y=x z=z / colormodel=( Blue Green Red ) colorresponse=z surfacetype=fillgrid ;
endlayout ;
endgraph ;
end ;
run ;
How do I specify, using yaxisopts, that I want the values to be reversed, e.g., from 10 to 0 on the y-axis which represents the depth dimension, to instead run from 0 to 10?
Thanks for a prompt reply.
I checked the online documentation for general axis options for LAYOUT OVERLAY3D and did not find any reference to 'reverse='. There is, however, a 'reverse=true' option for general axis options for LAYOUT OVERLAY.
I get the following error:
The solution to my question is to be found here: https://support.sas.com/kb/24/859.html.
The description is: "This sample uses PROC G3D to reverse the values on the Y axis. The sample code multiplies the Y data values by -1 in order to reverse the axis order. A user-defined format is then created with PROC FORMAT to format the new Y axis values back to their original values."
Of course, it also works for the PROC TEMPLATE layout overlay3d surfaceplotparm case, too. The sample code is attached.
I've just had the same problem.
My not so elegant solution multiplies by -1 and then uses tickvaluelist and tickdisplaylist.
proc template; /* surface plot with continuous color ramp */
define statgraph SurfaceTmplt;
dynamic _KMS _AGE _Z _Title; /* dynamic variables */
begingraph;
entrytitle _Title; /* specify title at run time (optional) */
layout overlay3d / tilt=30
xaxisopts=(label="kms" linearopts=(tickvaluelist=(0 30000 60000 90000 120000 150000 180000 240000 300000 )) )
yaxisopts=(label="age" linearopts=(tickvaluelist=(-12 -24 -60 -84 -108 -120 )
tickdisplaylist=('12' '24' '60' '84' '108' '120')))
zaxisopts=(label="sales result" );
surfaceplotparm x=_KMS y=_AGE z=_Z / /* specify variables at run time */
name="surface"
surfacetype=fill
colormodel=threecolorramp /* or =twocolorramp */
colorresponse=_Z
reversecolormodel=true;
continuouslegend "surface";
endlayout;
endgraph;
end;
run;
Thank you for sharing your work with us, acordes.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.