The SAS system option
FMTSEARCH= tells SAS to search in the SASHELP.MAPFMTS catalog for
map-related formats. In the PROC SQL step, a temporary table is created
with Country, High, and ID columns. The calculation
round((mean(avgHigh)-32)/1.8)
does the following:
-
For countries that are
represented by more than one city, the mean of the cities' average
high temperatures is used for that country.
-
That value is converted
from degrees Fahrenheit to degrees Celsius.
-
The result is rounded
to the nearest degree.
The PUT function uses
the $GLCSMN. format to convert the country name to a country code.
The INPUT function converts this country code, which is returned by
the PUT function as a character value, into a numeric value that can
be understood by the GMAP procedure. See
SAS Functions and CALL Routines: Reference for details about the PUT and INPUT functions.
The WHERE clause limits
the output to European countries by checking the value of the Country
column against the list of European countries that is returned by
the in-line view. Also, rows with missing values of ID are eliminated.
Missing ID values could be produced if the $GLCSMN. format does not
recognize the country name.
The GROUP BY clause
is required so that the mean temperature can be calculated for each
country rather than for the entire table.
The PROC GMAP step uses
the ID variable to identify each country and places a block representing
the High value on each country on the map. The ALL option ensures
that countries (such as the United Kingdom in this example) that do
not have High values are also drawn on the map. In the BLOCK statement,
the LEVELS= option specifies how many response levels are used in
the graph. For more information about the GMAP procedure, see
SAS/GRAPH: Reference.