# Setting up OLAP Data for the OLAPESRIMapChart

## Overview

To associate the values in your OLAP data with the regions of an ESRI map, your cube must contain member properties whose values match the field values in the ESRI map service. For each level of a hierarchy that you want to use with the ESRI map component, you must define a member property named SAS_SPATIAL_ID to identify the map region.

## Selecting Columns

For each level, the column that you specify for the SAS_SPATIAL_ID property must fulfill the following requirements:

- the values must match the values of a field in the appropriate layer of the ESRI map service (case sensitive).
- the values must be unique. For example, a column that contains the names of regions might have multiple instances of Southeast.

### Example

A cube contains a Geography hierarchy with the levels Country > Region:

Level | Column | Description
Country | Country_name | identifies the countries by name
Region | Region_name | identifies the regions by name
(none) | Region_code | identifies the regions by region code

The ESRI map service contains layers named Countries and Regions, which correspond to the Country and Region levels:

Layer | Field | Field Description
Countries | country-name | identifies the countries by name
country-code | identifies the countries by code
Regions | region-name | identifies the regions by name
region-code | identifies the regions by code

#### Selecting a Column for the Country Level

The values in the Country_name column are unique, and they match the values of the country-name field, so you can use these values to associate the Country level with the Countries layer. In your OLAP data, create a SAS_SPATIAL_ID property for the Country level and specify the Country_name column. In the ESRI mapping configuration file, specify the country-name field in the definition for the Countries layer.

#### Selecting a Column for the the Region Level

The values in the Region_name column match the values of the region-name field, but they are not unique. For example, there is a West region for several countries. The values in the Region_code column are unique, and they match the values of the region-code field, so you can use these values to associate the Region level with the Regions field. In your OLAP data, create a SAS_SPATIAL_ID property for the Region level and specify the Region_code column. In the ESRI mapping configuration file, specify the region-code field in the definition for the Regions layer.

## Creating Member Properties

To create the member properties, you can use two different methods:

- use SAS code
- use SAS OLAP Cube Studio

### Create the Member Properties by Using SAS Code

You can create member properties by using the PROPERTY statement in the OLAP procedure. For example, the following code fragment creates the properties for the Geography hierarchy from the preceeding example:

    property SAS_SPATIAL_ID column=Country_name
                            hierarchy=Geography
                            level=Country;

    property SAS_SPATIAL_ID column=Region_code
                            hierarchy=Geography
                            level=Region;

For more information, see The OLAP Procedure in SAS OLAP Server: Administrator's Guide.

### Create the Member Properties by Using SAS OLAP Cube Studio

To create member properties by using SAS OLAP Cube Studio:

1. Open SAS OLAP Cube Studio and connect to the metadata repository.
2. In the navigator panel, select the cube that you want to edit and then select Actions -> Edit Cube Structure.
3. In the Cube Designer wizard, click Next until you reach the Member Property window.
4. Click Add.
5. In the Define a Member Property dialog box, fill in the following fields:

   Name | - enter SAS_SPATIAL_ID.
   Level | - select the hierarchy level.
   Column | - select the column that corresponds to the level that you selected.

6. Click OK to create the member property and return to the Member Property window.
7. Repeat steps 4-6 to create a SAS_SPATIAL_ID property for each level of the hierarchy that you want to use with the ESRI map component.
8. Click Next until you reach the Finish window, and then click Finish to save the changes to your cube.