BookmarkSubscribeRSS Feed
acordes
Rhodochrosite | Level 12

I use proc sgrender for a 3D surfaceplot.

Everything works fine except that the xaxis and yaxis do not meet at their highest values. 

I do not find the option to reverse the axis. The x values are multiplied by -1 to achieve the wanted visualization, but the xaxisvalues now show negative values. 

I wanted to trick the code by creating a format to show positive xaxisvalues again. 

 

But it doesn't work.

 

For the context I attach my code, but you cannot use it like this. It should serve to put you in the picture.

 

pic.png

 


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" )
          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;

data RISKNOBA.SCORED;
set RISKNOBA.SCORED;
_meses_efectivos=-meses_efectivos;
run;

proc format;
value abs low-high = [abs()];
run;

ods graphics / width=20cm height=20cm  ;    
proc sgrender data=RISKNOBA.SCORED template=SurfaceTmplt; 
where _RMCTMAIMG='6C122V' and byear=2021;
   dynamic _KMS='_o_actual_mileage' _AGE='_meses_efectivos' _Z='P_it_based_sales_res' _Title="3D graph";
format P_it_based_sales_res percent7.0 _meses_efectivos abs.;
run;

 

2 REPLIES 2
ballardw
Super User

Did you try placing the values in the TICKVALUELIST in reverse order?

acordes
Rhodochrosite | Level 12

Thanks @ballardw 

Finally I've solved it using the negative value and using the tickvaluedisplaylist.

 

I'd like to use a format in the proc template, this would be smarter. But I don't know how.   

 

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;

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 151 views
  • 0 likes
  • 2 in conversation