BookmarkSubscribeRSS Feed
tucay
Calcite | Level 5
*annotated data set that im using to get state abbreviations on my state maps;
data maplabel; length function $ 8; retain flag 0 xsys ysys '2' hsys '3' when 'a' style "'Albnay'"; set maps.uscenter(drop = long lat); where fipstate(state) ne 'DC' and fipstate(state) ne 'PR'; function = 'label'; text=fipstate(state); size=2.5; position='5'; if ocean = 'y' then do; position = '6'; output; function = 'move'; flag = 1; end; else if flag = 1 then do; function = 'draw'; size = .5; flag = 0; end; output; run;

So i have two different maps one thats more basic and one that has more going on.

basic map where maplabel works and the state abbreviations work... the map is of just states;


proc gmap data=work.zipfilter map=maps.us (where=(statecode in ('CA'))); id statecode; choro m_obs / annotate = maplabel; run;
proc gmap data=work.heatmapaverage_data map=work.counties (where=(statecode in ('CA', 'NV', 'AZ', 'UT', 'OR', 'WA', 'MT', 'ND', 'ID', 'WY', 'SD'))) all;
id id;
choro paymentperbene / annotate = maplabel
                                        level = 10
                                        cdefault = royalblue
                                        legend legend1
                                        coutline = black;
run;

*more advanced data set that features the counties of each state;
proc sql;
create table counties as
      select c.*, us.idname
      from mapsgfk.us_counties as c
      left join mapsgfk.us_counties_attr as us
      on c.id = us.id;
      run;

The proc sql creates the map dataset, counties, from data sas enterprise guide gives us. Unfortunately i cant share my response data set.

 

 

Im new to sas and i dont understand what the disconnect is.

why would maplabel work on the first gmap and not on the second gmap.

No errors are given for either maps

 

Any tips and tricks would help.

Thanks a bunch.

 

First gmap

cali_map.PNG

Second gmap

conties.PNG

I was hoping that the state abbreviations would show on the second map as well

 

2 REPLIES 2
ballardw
Super User

Doesn't work is awful vague.

Are there errors in the log?: Post the code and log in a code box opened with the {i} to maintain formatting of error messages.

No output? Post any log in a code box.

Unexpected output? Provide input data in the form of data step code pasted into a code box, the actual results and the expected results. Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.

 

You want to check the log for entries about "outside of area" or 0 observations selected. That would point to a number of possible data issues.

 

You if you generated an output map you should post a picture to give us more ideas.

If not map was generate then it is possible that you did not create a STATECODE variable that matches the type of the values in your where statement.

Depending on actual colors displayed sometimes the color of your annotate text may be hard to pick out of the map.

 

Note that your first GMAP will not run as posted as the where clause doesn't have a second quote around CA.

 

BTW, GMAP ends with a QUIT statement as you can have multiple maps generated by a single Proc call,

 

 

tucay
Calcite | Level 5
Thanks for the response and your input. I added some stuff to the original post.
Just to add there was no errors given. Something about the second gmap isn't allowing for the abbreviations to show.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 843 views
  • 1 like
  • 2 in conversation