BookmarkSubscribeRSS Feed
rbettinger
Pyrite | Level 9

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?

5 REPLIES 5
svh
Lapis Lazuli | Level 10 svh
Lapis Lazuli | Level 10
Have you tried the reverse=TRUE option in YAXISOPTS?
rbettinger
Pyrite | Level 9

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:

ERROR 22-322: Syntax error, expecting one of the following: DISPLAY, GRIDATTRS, GRIDDISPLAY, LABEL, LABELATTRS, LINEAROPTS,
LOGOPTS, OFFSETMAX, OFFSETMIN, TICKVALUEATTRS, TIMEOPTS, TYPE
in the following code:
proc template;
define statgraph surfaceplotparm;
begingraph;
entrytitle "Surface Plot of Lake Bed";
layout overlay3d / cube=false xaxisopts=(label='Length of Lake') yaxisopts=( reverse=true ) ;
surfaceplotparm x=length y=width z=depth ;
endlayout;
endgraph;
end;
run;
so I may just have to get creative to produce the results that I want.

rbettinger
Pyrite | Level 9

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.

acordes
Rhodochrosite | Level 12

@rbettinger @svh 

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;
rbettinger
Pyrite | Level 9

Thank you for sharing your work with us, acordes.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 5 replies
  • 1698 views
  • 3 likes
  • 3 in conversation