Hi....I would like to annotate the names of a country and population size from a list so that the only the names on the country along with their population size appears on the world map. I have found a lot of information that annotates cities but I can't find much on countries. Thanks.
proc sgmap mapdata=maps.world maprespdata=sashelp.demographics;
choromap id / mapid=id id=id;
run;
You would need to provide an appropriately subsetted dataset to the PLOTDATA = option of the PROC SGMAP statement. PLOTDATA supplies the TEXT statement of SGMAP procedure, that determines what is written on the map.
For example, this code would display country names from the variable idname:
PROC SQL;
CREATE TABLE countrynames AS
SELECT id AS id, mean(x) AS xc, mean(y) AS yc, min(idname) AS idname
FROM maps.world
/* You can also choose specific countries, e.g. WHERE idname IN ('Russia','Poland','Ukraine') */
GROUP BY id;
QUIT;
PROC SGMAP MAPDATA = maps.world /* Map boundaries */
MAPRESTDATA = countrynames /* For colours */
PLOTDATA = countrynames /* For names */
;
CHOROMAP idname / MAPID= id ID= id;
TEXT X= xc Y= yc TEXT= idname / TEXTATTRS= (SIZE= 3pt COLOR= steel);
RUN;
Reference: https://amadeus.co.uk/sas-tips/maps-in-ods-graphics-proc-sgmap/
You would need to provide an appropriately subsetted dataset to the PLOTDATA = option of the PROC SGMAP statement. PLOTDATA supplies the TEXT statement of SGMAP procedure, that determines what is written on the map.
For example, this code would display country names from the variable idname:
PROC SQL;
CREATE TABLE countrynames AS
SELECT id AS id, mean(x) AS xc, mean(y) AS yc, min(idname) AS idname
FROM maps.world
/* You can also choose specific countries, e.g. WHERE idname IN ('Russia','Poland','Ukraine') */
GROUP BY id;
QUIT;
PROC SGMAP MAPDATA = maps.world /* Map boundaries */
MAPRESTDATA = countrynames /* For colours */
PLOTDATA = countrynames /* For names */
;
CHOROMAP idname / MAPID= id ID= id;
TEXT X= xc Y= yc TEXT= idname / TEXTATTRS= (SIZE= 3pt COLOR= steel);
RUN;
Reference: https://amadeus.co.uk/sas-tips/maps-in-ods-graphics-proc-sgmap/
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.