Hello Experts,
I'm using the proc gmap to display the map of France by department, but the result does not have the Corse departments.
The id for this department is "2A" and "2B".
Do you know, please, how to display the name of departments?
Thank you for your help!
You can use the annotate facility to place the department names on the map.
The %maplabel annotate macro will calculate the center of the map area and create an annotate data set to place the label on the map.
For example:
%annomac;
%maplabel(mapsgfk.france,mapsgfk.france_attr,labels,idname,id); /* the text for label is in the IDNAME variable */
proc gmap data=mapsgfk.france_attr map=mapsgfk.france;
where id1='FR-94'; /* subset for Corse region for demo */
by id;
id id;
choro id / discrete anno=labels;
run;
quit;
Regards,
Marcia
One of the nice things about the way the SAS macro language works is that even when you have defined your macro to allow the parameter values to be passed by their position in the macro call you can still pass the values using the parameter names.
This makes for code that is more self documenting.
%maplabel
(mapds=mapsgfk.france
,attrds=mapsgfk.france_attr
,outds=labels
,textvar=idname
,ids=id
,font=swiss
,color=black
,size=2
,hsys=3
,segonly=
);
Thank you Marcia,
I have an issue with ID column in my data. I need to recod it.
What represents the id and id1 in mapsgfk.france ?
I joined my data.
Thank you for your help!
In your TEST data set, the ID variable appears to correspond to the ID variable in the MAPSGFK.FRANCE data set except for the observations for the Corse region.
The TEST data set has 3 observations with ID='FR-94'.
| Obs | id | nom_departement | Valeur |
|---|---|---|---|
| 98 | FR-94 | Corse-du-Sud | 7.6895 |
| 99 | FR-94 | Haute-Corse | 6.4195 |
| 100 | FR-94 | Val-de-Marne | 18.9159 |
For observations 98 and 99, the ID value should be FR-2A and FR-2B, respectively, and their region code (ID1 in MAPSGFK.FRANCE) would be FR-94.
Observation 100 has the correct Deparment code FR-94.
Hope that helps.
Marcia
I have an issue with this ID1, its seems missing in mapsgfk.france.
| nom_departement | code_region | ID1 | ID |
| Guadeloupe | 1 | FR-. | FR-97 |
| Martinique | 2 | FR-. | FR-97 |
| Guyane | 3 | FR-. | FR-97 |
| La Réunion | 4 | FR-. | FR-97 |
Dive into keynotes, announcements and breakthroughs on demand.
Explore Now →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.
Ready to level-up your skills? Choose your own adventure.