There is an Object “Geo Map” in SAS Visual Analytics 8.4. Using Geo Map, the Bubble map, Co-ordinate map, Contour Map and Region Map can be created. But for Region Map the main requirement is Polygon Data.
What is Polygon Data?
The Polygon data is a set of several Latitude and Longitude and these Latitude and Longitude together create the boundary of a state. If one Latitude and longitude is available for a state then we can show Bubble map only not Region Map. The Polygon data can be downloaded from Website or purchased from ESRI. The Polygon data mainly contains five files:
Here “Area” is the name of file, it may be different for shape files but the extension of polygon data should be ‘cpg’, ‘dbf’, ‘prj’, ‘shp’ and ‘shx’. All these files are necessary for Region Map.
Ways to make SAS Dataset for Region Map:
There are two ways to make the data usable for Region Map:
- SAS Code for Polygon Data:
Figure 1: Code to convert shape file into SAS Dataset
- Data available from SAS:
SAS also made available polygon dataset. There are three library present “MAPS”, “MAPSGFK” and “MAPSSAS” in SAS EG / SAS Studio. These library contain the dataset of all the countries at State level.
Figure 2: Polygon dataset in libraries in SAS EG
For each country, two tables are available. So we have to join the tables by ID column.
Import SAS Dataset in SAS Viya VA:
- Login the SAS Viya VA environment.
- Click on “Data” option and go to import as mentioned in below image.
- Import the polygon data as we prepared and after that click on “OK”.
Figure 3: Importing dataset in SAS Viya VA
Now, the data is imported in CAS and you can see the all variable available in data in SAS Viya VA.
Configure the Geography Item:
- Click on the “+ New data item” in data pane.
- Select the Geography Item.
- Type the Name of new created geography variable and select the dataset in “Based on:” field.
- Select “Custom polygon shapes” in drop down of Geography data type option.
- Click on the “New” in Custom Polygon provider.
Figure 4: Creating New Custom Polygon Provider
- Fill the information mentioned in below images:
Figure 5: Entering Information in Library and Table
Figure 6: Entering Information in ID Column
In Figure 6, the “ID Column” is DISTRICT but if any ID variable available in your data that represent the location, then you can also select that.
- Next, after filling the below information, you can see that the data is 100% mapped.
Figure 7: Select Region ID and Latitude & Longitude
- Now, drag and drop the new created geography variable (“Area” in my case). Go to the Options and select “Region Map” in “Map Type” and click on “Map Background” icon.
Figure 8: Final Region Map in SAS Viya VA
In Map Service option, you can change the background map. Here is the Region Map of District Level.
Thus, we can create the region map for the country, state, tehsil and city based on availability of polygon data.