Sample 25606: Spline interpolation and a smoothed spline using PROC G3GRID
This sample is from the "SAS/GRAPH Software: Reference, Version 8", Volume 2, Chapter 30.
For additional information on the sample refer to this book.
/*+-------------------------------------------------------------+
| S A S S A M P L E L I B R A R Y |
| |
| NAME: GTGSISS |
| TITLE: GTGSISS-Spline Interpolation and a Smoothed Spline |
| PRODUCT: GRAPH |
| SYSTEM: ALL |
| KEYS: GRAPHICS GOPTIONS G3D G3GRID AXIS |
| PROCS: G3D G3GRID |
| DATA: INTERNAL |
| |
| SUPPORT: GRAPHICS STAFF UPDATE: |
| REF: SAS/GRAPH REFERENCE GUIDE |
+-------------------------------------------------------------+*/
/* Set the graphics environment */
goptions reset=global gunit=pct border cback=white
colors=(blue black green red)
ftext=swiss ftitle=swissb htitle=5 htext=3;
/* Create data set WORK.NUMS using */
/* a set of randomly sampled points */
data nums;
keep x y z;
do i=1 to 30;
x=10*ranuni(33)-5;
y=10*ranuni(35)-5;
z=sin(sqrt(x*x+y*y));
output;
end;
run;
/* Define title and footnote for graph */
title 'Surface Plot After Spline Interpolation';
footnote j=r 'GTGSISS(a)';
/* Process points with PROC G3GRID */
proc g3grid data=nums out=spline;
grid y*x=z / spline
axis1=-5 to 5 by .5
axis2=-5 to 5 by .5;
run;
/* Generate a surface plot */
proc g3d data=spline;
plot y*x=z;
run;
/* Define title and footnote for graph */
title 'Surface Plot After Smoothed Spline Interpolation';
footnote j=r 'GTGSISS(b)';
/* Process points with PROC G3GRID */
proc g3grid data=nums out=smoothed;
grid y*x=z / spline
smooth=.05
axis1=-5 to 5 by .5
axis2=-5 to 5 by .5;
run;
/* Generate a surface plot */
proc g3d data=smoothed;
plot y*x=z;
run;
quit;

This example specifies a spline interpolation method on the GRID statement to output data that generates a smoother surface plot.
| Type: | Sample |
| Topic: | Query and Reporting ==> Creating Reports ==> Graphical ==> Graph Elements ==> Symbols/Interpolation SAS Reference ==> Procedures ==> G3D SAS Reference ==> Procedures ==> G3GRID
|
| Date Modified: | 2005-08-06 03:02:46 |
| Date Created: | 2005-05-23 14:18:34 |
Operating System and Release Information
| SAS System | SAS/GRAPH | All | 8 TS M0 | n/a |