Sample 25606: Spline interpolation and a smoothed spline using PROC G3GRID and PROC G3D
The sample code on the Full Code tab uses a spline interpolation method in the GRID statement of PROC G3GRID to output data that generates a smoother surface plot with PROC G3D.
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
This sample code uses a spline interpolation method on the GRID statement with PROC G3GRID to output data that generates a smoother surface plot with PROC G3D.
/* Set the graphics environment */
goptions reset=all border cback=white htitle=12pt;
/* 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 a title for the graph */
title1 'Surface Plot After Spline Interpolation';
/* 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 a title for the second graph */
title1 'Surface Plot After Smoothed Spline Interpolation';
/* 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;
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
This example uses a spline interpolation method on the GRID statement with PROC G3GRID to output data that generates a smoother surface plot with PROC G3D.
Type: | Sample |
Topic: | SAS Reference ==> Procedures ==> G3D SAS Reference ==> Procedures ==> G3GRID
|
Date Modified: | 2021-05-17 11:30:19 |
Date Created: | 2005-05-23 14:18:34 |
Operating System and Release Information
SAS System | SAS/GRAPH | z/OS | 9 TS M0 | |
Microsoft® Windows® for 64-Bit Itanium-based Systems | 9 TS M0 | |
Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9 TS M0 | |
Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9 TS M0 | |
Microsoft Windows 2000 Advanced Server | 9 TS M0 | |
Microsoft Windows 2000 Datacenter Server | 9 TS M0 | |
Microsoft Windows 2000 Server | 9 TS M0 | |
Microsoft Windows 2000 Professional | 9 TS M0 | |
Microsoft Windows NT Workstation | 9 TS M0 | |
Microsoft Windows Server 2003 Datacenter Edition | 9 TS M0 | |
Microsoft Windows Server 2003 Enterprise Edition | 9 TS M0 | |
Microsoft Windows Server 2003 Standard Edition | 9 TS M0 | |
Microsoft Windows XP Professional | 9 TS M0 | |
64-bit Enabled AIX | 9 TS M0 | |
64-bit Enabled HP-UX | 9 TS M0 | |
64-bit Enabled Solaris | 9 TS M0 | |
HP-UX IPF | 9 TS M0 | |
Linux | 9 TS M0 | |
OpenVMS Alpha | 9 TS M0 | |
Tru64 UNIX | 9 TS M0 | |