BookmarkSubscribeRSS Feed
sanjay1
Obsidian | Level 7

Am trying to draw a map with employee count for each state of usa using sas gmaps procedure.

 

1) The dataset stlabel have stcnt(employee count), and statecode (for each state), and region.
2) I want to get the employee count for each state to be displayed

data stlabel;
set mapfips;
length function $ 8 position $ 1
text $ 20;
text=stcnt;
xsys = '2' ;
ysys= '2' ;
hsys = '3' ;
position = '5' ;
function= 'label';
color= 'black';
when ='after';
run;

proc gmap data=mapfips map=maps.us;
id STATECODE;
choro region/ annotate=stlabel;
run;
quit;

 

4 REPLIES 4
ballardw
Super User

When you run the code do you get any messages? Any output? Map but not with the annotation?  Did you try putting the annotate clause on the Proc GMAP statement?

 

If the xlsx file is data please repost as text, preferrably as a datastep if you want us to test code. If we have to read data then we may not have the same values because of choices made to import Excel files. This link: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will provide information on how to create a datastep from a dataset.

 

 

Darrell_sas
SAS Employee

MAPS.US is in Projected Radians.  You must project your Annotate data and your map data together so it will be in the same projection.  But maps.us does not have any unprojected data so you can do that.  You must start with something like MAPS.STATES which has unprojected radians.  Your annotate data must be in unprojected radians too.  (alternately, use MAPSGFK.COUNTIES which has LAT and LONG as Unprojected Degrees).

 

So, convert the annotated data to radians if it is in degrees (unless using MAPSGFK).

Add an anno_flag=1 variable to the annotate data.

Combine the map data and the annotate data into the same data set.

Proc GPROJECT this data set.

Split the data back into 2 data sets: Map and Annotate using the anno_flag variable.

GMAP the map and annotate data.

 

Darrell_sas
SAS Employee

Sorry, I meant MAPSGFK.US_STATES as an alternative.

 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 4 replies
  • 1158 views
  • 0 likes
  • 3 in conversation