The KRIGE2D Procedure

GRID Statement

GRID grid-options </ option> ;

The GRID statement specifies the grid of spatial locations for kriging predictions. The grid specification is applied to all PREDICT and MODEL statements. Specify the grid in one of the following three ways:

  • Specify the x and y coordinates explicitly for a grid in two dimensions.

  • Specify the NPTS= option in addition to the x and y coordinates to define a grid of individual points or in one dimension.

  • Specify the coordinates by using a SAS data set for a grid of individual points or in one dimension.

The GRID statement has the following grid-options:

NPTS=number | ALL

controls specification of a grid in one dimension or a grid of individual prediction locations.

When you specify the NPTS=number option and the coordinates of two points in the GRIDDATA= data set or in both the X= and Y= options, you request a linear prediction grid. Its direction is across the line defined by the specified points. The grid size is equal to the number of points that you specify in the NPTS= option, where number $\geq 2$.

When you specify the NPTS=ALL option and the coordinates for any number of points in the GRIDDATA= data set or in each of the X= and Y= options, the KRIGE2D procedure performs prediction only at the specified individual locations. Use the NPTS=ALL option to examine a set of individual points anywhere on the XY plane or to specify a custom grid in one dimension.

If the number of x coordinates and the number of y coordinates in the X= and Y= options, respectively, are different, then the NPTS= option is ignored; in that case, a two-dimensional grid is used according to the specified X= and Y= options.

If you specify a prediction grid with any number of points other than two in the GRIDDATA= data set, then the option NPTS=ALL has the same effect as omitting the NPTS= option.

X=number
X=$x_1,\dots ,x_ m$
X=$x_1$ to $x_ m$
X=$x_1$ to $x_ m$ by $\delta x$

specifies the x coordinate of the grid locations.

Y=number
Y=$y_1,\dots ,y_ m$
Y=$y_1$ to $y_ m$
Y=$y_1$ to $y_ m$ by $\delta y$

specifies the y coordinate of the grid locations.

Use the X= and Y= options of the GRID statement to specify a grid in one or two dimensions, or a grid of individual prediction locations.

For example, the following two GRID statements are equivalent.

grid x=1,2,3,4,5  y=0,2,4,6,8,10;
grid x=1 to 5 y=0 to 10 by 2;

In the following example, the first GRID statement produces a grid in two dimensions. The second statement produces predictions only for the four individual points at the locations (1,0), (2,5), (3,7), and (4,10) on the XY plane.

grid x=1 to 4 y=0,5,7,10;
grid x=1 to 4 y=0,5,7,10 npts=all;

In the next example, the first GRID statement specifies a 2-by-2 grid in two dimensions. The second GRID statement specifies a linear grid of eight points. The grid is in the direction of the line defined by the specified points (2,8) and (3,5) on the XY plane and it extends between these two points.

grid x=2,3 y=8,5;
grid x=2,3 y=8,5 npts=8;

The last example shows a GRID statement that specifies a linear grid made of seven points across the Y axis. In this case, the syntax is sufficient to fully define a linear grid without the NPTS= option.

grid x=5 y=3 to 9;

To specify grid locations from a SAS data set, you must provide the name of the data set and the variables that contain the values of the x and y coordinates.

GRIDDATA=SAS-data-set
GDATA=SAS-data-set

specifies a SAS data set that contains the x and y grid coordinates. Use the GRIDDATA= option of the GRID statement to specify a grid in one dimension or a grid of individual prediction locations.

XCOORD= (variable-name)
XC= (variable-name)

specifies the name of the variable that contains the x coordinate of the grid locations in the GRIDDATA= data set.

YCOORD= (variable-name)
YC= (variable-name)

specifies the name of the variable that contains the y coordinate of the grid locations in the GRIDDATA= data set.

You can specify the following option in the GRID statement after a slash (/):

LABEL <(suboption)> = (character-list)

specifies labels to tag grid points in prediction plots when you use grids in one dimension. You can specify one or more such labels as quoted strings in the character-list.

When the number of labels in the character-list exceeds the number of points in your grid, the labels in the list are used sequentially and any labels in excess are ignored. When the number of labels in the character-list is smaller than the number of points in your grid, the behavior is as follows:

  • If an area map is included in the prediction plot, then blank labels are assigned to the remaining nonlabeled grid points on the map.

  • For the prediction band and scatter plots, the coordinates of nonlabeled grid points are automatically assigned as their labels.

If the grid points are collinear and the horizontal axis displays distance, then two labels appear by default in the prediction plot. These are assigned to the first and the last points of the grid to help identify the ends of the linear grid segment on the plot map. This label pair is shown only when the plot includes an area map. Specifically, the two labels appear when you request prediction band plots, or prediction scatter plots for which you specify the PREDICTION(SHOWD) suboption, if applicable. The two labels do not appear if you specify explicitly the NOMAP suboption in the PLOTS=PRED option.

The two labels have default values, unless you choose to specify your own labels with the LABEL= option. If you specify more than two labels in the character-list under these conditions, then only the first and last labels in the list are used; any additional labels in between are ignored.

The LABEL= option has the following suboption:

ALL

specifies that all individual points in the grid be assigned sequentially the labels you specify in the LABEL(ALL)= option when the PREDICTION(SHOWD) suboption is applicable and specified in a prediction scatter plot. In all other cases, the ALL suboption is ignored.

The ALL suboption enables you to override the default behavior when the PREDICTION(SHOWD) suboption is specified (the default behavior is to display labels only for the first and last grid points). As a result, you can use the ALL suboption to label grid points regardless of whether you specify the NOMAP suboption in the PLOTS=PRED option.

The LABEL= option is ignored when you produce prediction plots of grids in two dimensions.