BookmarkSubscribeRSS Feed
Danitinho
Calcite | Level 5

I have this map with the Brazilian states:

 

 

data estados;
	set maps.brazil;
run;

proc sort data = work.estados nodupkey;
by ID;
run;
data estados; set work.estados; xsys='2'; ysys='2'; hsys='3'; when='a'; function='pie'; style='psolid'; rotate=360; size=1; color='red'; run; title1 ls=1.5 "Estados Brasileiros"; pattern1 v=s c='white'; proc gmap map=maps.brazil anno=work.estados; id id; choro segment / levels=1 nolegend coutline=gray88; run;

 

 

the "anno=work.estados" mark some states on the map.

I have a dataset with coordinates (latitude and longitude), someone know how i show a marker for each coordinate?

2 REPLIES 2
ballardw
Super User

The Maps.Brazil data set contains Lat and Long variables. So if your annotate data does as well and have the same names you may be able to use the LATLON option on Proc Gmap to use those instead of the X Y variables for plotting.

 

proc gmap map=maps.brazil anno=work.estados
   LATLON
;
   id id;
   choro segment / levels=1 nolegend coutline=gray88;
run;
GraphGuy
Meteorite | Level 14

If you're working with lat/long point data, I would recommend projecting the map, and then projecting the point data (using the exact same parameters as were used to project the map). You could work with unprojected lat/long values, but having the code in place to apply any projection you want really adds a lot of flexibility (and is the best-practice way to go).

 

Here's an example:

 

data my_map; set mapsgfk.brazil (where=(density<=3) drop=x y resolution);
run;

 

proc gproject data=my_map out=my_map latlong eastlong degrees parmout=projparm;
id id;
run;

 

data point_data;
input lat long;
datalines;
-11.3994052 -41.2813161
-9.0266125 -38.4466716
;
run;

 

proc gproject data=point_data out=point_data latlong eastlong degrees parmin=projparm parmentry=my_map;
id;
run;

 

data anno_point_data; set point_data;
xsys='2'; ysys='2'; hsys='3'; when='a';
function='pie'; style='psolid'; rotate=360; size=1; color='red';
run;

 

pattern1 v=s c=white;

 

title "Brazil, with annotated lat/long point data";
proc gmap map=my_map data=my_map anno=anno_point_data;
id id;
choro segment / levels=1 nolegend coutline=gray77;
run;

 

brazil_anno.png

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 739 views
  • 0 likes
  • 3 in conversation