Notice In this sp_plot package of macros includes 6 separate macros: sp_plot sp_plota sp_plotbx1 sp_plotbx1x2 sp_plotbx1x1x2 fixlen Each macro has its own help file with explanations and examples which can be accessed by running the following code: %local_help(macro_name) ---------------------------------------------------------------------- %sp_plot ---------------------------------------------------------------------- Create a 3 dimensional plot of a regression surface Description The %sp_plot macro will create a 3 dimensional plot of a regression surface based on the coefficients from two predictors in a regression equation. The graph can be saved as a .gif file and used in a web page. The code for this macro should end in a semicolon in order to avoid unnecessary error messages in the log file. The code for this macro should end in a semicolon in order to avoid unnecessary error messages in the log file. Syntax %sp_plot(angle=0, x1lo=-10, x1hi=10, x1by=1, x2lo=-10, x2hi=10, x2by=1, cons=0, bx1=0, bx2=0, bx1x2=0, bx1x1=0, bx2x2=0, bx1x1x2=0, bx1x2x2=0, outfile=' ', data=_spinplt, dev=gif373, title= "3-D Plot ", title2 = "y=&cons+&bx1*x1+&bx2*x2+&bx1x2*x1*x2", cmd=plot, plot=, gopt=, reset=yes); angle - angle of the graph in the x1,x2 plane x1lo - the minimum value of the range of x1 x1hi - the maximum value of the range of x1 x1by - the spacing of the grid of the regression surface x2lo - the minimum value of the range of x2 x2hi - the maximum value of the range of x2 x2by - the spacing of the grid of the regression surface const - the value of the constant in the regression function bx1 - the value of the coefficient of x1 in the regression function bx2 - the value of the coefficient of x2 in the regression function bx1x2 - the value of the coefficient of x1*x2 in the regression function bx1x1 - the value of the coefficient of x1*x1 in the regression function bx2x2 - the value of the coefficient of x2*x2 in the regression function bx1x1x2 - the value of the coefficient of x1*x1*x2 in the regression function bx1x2x2 - the value of the coefficient of x1*x2*x2 in the regression function outfile - saves the graph as a .gif file with the given name data - saves the data with the given name dev - specifies the graphic device used title - the title displayed at the top of the graph title2 - the second title displayed at the top of the graph the default is to display the regression function used to generate the graph cmd - specifies if the graph is a plot (the data points define a surface) or a scatter plot (represents each data point with a specified shape, the default is a pyramid) plot - specifies other options for the graph, the options available willdepend on whether cmd was specified as scatter or plot (plot is the default) gopt - specifies other goptions which can modify the detailed options on the size, color or the style of the plot reset - determines if all the options that have been specified are reset Examples %sp_plot(outfile='c:\sp_plot1.gif', angle=20, bx1=-2, bx1x2=-1 ); %sp_plot(outfile='c:\sp_plot2.gif', angle=80, cons=1, bx1=-2, bx2=1.7, bx1x2=-2); %sp_plot(outfile='c:\sp_plot3.gif', angle=20, bx1=-2, bx1x2=-1 , x1lo=-3, x1hi=3, x1by=.4, x2lo=-2, x2hi=2, x2by=.4, plot= zmin=-12 zmax=18 ); %sp_plot(outfile='c:\sp_plot4.gif', angle=20, bx1=-2, bx1x2=-1, plot= grid ctop=green cbottom=red caxis=black); %sp_plot(outfile='c:\sp_plot5.gif', angle=20, bx1=-2, bx1x2=-1 , cmd=scatter, plot= noneedle grid shape='balloon'); %sp_plot(outfile='c:\sp_plot6.gif', angle=20, bx1=-2, bx1x2=-1 , cmd=scatter, plot= shape='balloon', gopt = border); %sp_plot(outfile='c:\sp_plot7.gif', bx1=1, bx2=-2, bx1x2x2=.1); Author Michael Mitchell mnm@ucla.edu UCLA Academic Technology Services Statistical Consulting Group Also See See a complete example in http://www.ats.ucla.edu/stat/sas/examples/aw/example_graphs.htm http://www.ats.ucla.edu/stat/sas/teach/reg_int/reg_int_cont.htm For more details about the cmd, plot and gopt options please refer to following sections in the SAS Manuals http://sasdocs.ats.ucla.edu/gref/z3d-plot.htm http://sasdocs.ats.ucla.edu/gref/zscatter.htm http://sasdocs.ats.ucla.edu/gref/zonschap.htm Also see the macro itself from http://www.ats.ucla.edu/stat/sas/macros/sp_plot.sas.txt Also see the books (http://www.ats.ucla.edu/stat/books/ ) Multiple Regression: Testing and Interpreting Interactions by Leona S. Aiken and Steven G. West Interaction Effects in Multiple Regression by James Jaccard, Robert Turrisi and Choi K. Wan