Chapter Contents


Using Spatial Data with SAS/GIS Software

LATTICE Statement

LATTICE outer-composite-name-1 ENCLOSES inner-composite-name-1
<...outer-composite-name-n ENCLOSES inner-composite-name-n>
<_UNIVERSE_ ENCLOSES inner-composite-name>;


The LATTICE statement defines the relationships between areas in a spatial database, that is, it defines which areas enclose other smaller areas (such as states enclose counties).

When a lattice hierarchy is defined, the area composite values for new points are assigned automatically as the points are added to the map. The composite values are also reevaluated automatically when an existing point is moved to a new location. A lattice definition also makes it possible to simultaneously assign attribute values to all points in a point layer by setting area attributes in the GIS Layer window. Area attributes cannot be assigned to new points, moved points, geocoded points, or imported points unless a lattice has been defined.

The lattice definition is written to the current spatial entry. If the current spatial entry already has a lattice definition, it is replaced. An error occurs if you submit a LATTICE statement when no spatial entry is currently selected.

Note:   Because the LATTICE statement uses composites, you must include a RUN statement following a COMPOSITE statement. This ensures that the composite is created before the LATTICE statement executes and attempts to use the composite.  [cautionend]

Note:   You cannot specify an operation argument (for example, UPDATE) in the LATTICE statement. REPLACE is the resulting operation. The only way to delete a lattice from a spatial entry is to execute a SPATIAL REPLACE operation.  [cautionend]

LATTICE Statement Arguments

The following arguments can be used with the LATTICE statement:
outer-composite-name ENCLOSES inner-composite-name
_UNIVERSE_ ENCLOSES inner-composite-name

An error occurs if there is no current spatial entry for the GIS procedure. Use the SPATIAL statement, omitting the operation keyword, to specify the current spatial entry.

The LATTICE statement checks lattice definitions for circular references. For example, a lattice definition of the following form would cause an error:

        B ENCLOSES C
        C ENCLOSES B;

The following list contains descriptions of the LATTICE statement arguments:

is an area composite that geographically contains other enclosed AREA type composites. Outer-composite-name must have the CLASS attribute AREA (or one of the political subdivision area classes such as COUNTRY, STATE, or COUNTY).

You can also use the special value _UNIVERSE_ to signify that inner-composite-name is a single area composite that is not contained within other enclosed areas and that does not itself enclose any other areas.

Is the separator between LATTICE composites. The following symbol can be used in place of ENCLOSES: → .

Is an area composite that is geographically placed within the outer-composite-name polygonal areas, or a single area. That is not contained by another when _UNIVERSE_ is outer-composite-name. Inner-composite-name must have the CLASS attribute AREA (or one of the political subdivision area classes such as COUNTRY, STATE, or COUNTY).

LATTICE Statement Examples

Single Hierarchy

For a lattice hierarchy that comprises several composites, the general form of the LATTICE statement is


Assume that the spatial database contains states that are subdivided into counties, that the counties are further subdivided into tracts, that the tracts are further subdivided into blocks, and that corresponding composites are defined for each. The following code fragment defines the lattice for the spatial database:

lattice state  encloses county
        county encloses tract
        tract  encloses block;

Multiple Hierarchies

You can define more than one lattice hierarchy for a spatial database, for example, when the map has overlapping AREA-type composites that are not related. A single LATTICE statement is used, but the GIS procedure recognizes the break between the two hierarchies, as follows:

lattice state  encloses county /* first lattice */ 
        county encloses tract  /* first lattice */  
        tract  encloses block  /* first lattice */      
        mall   encloses store; /* second unrelated lattice */         

Single-Element Lattice

If the map has only one AREA-type composite, it is called a universe-enclosed association. Use the _UNIVERSE_ keyword to define a lattice for a universe-enclosed association, as follows:

lattice _universe_ encloses tract;

Chapter Contents



Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.