BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
rcleven2
Obsidian | Level 7

I have a problem with a getting hover-over/tool-tip text to appear on my map correctly. I have a 6-county area that I have mapped and each county has multiple specific addresses that I have previously geocoded and specified. My problem comes in that the each dot produces that same text in each county. So all the dots in county A show Bob Smith and all the dots in county B show Carl Anderson and so on and so forth. 

 

Why is it that proc gmap procedure relegates the html= option to an area on the map and not the dot I want plotted? I can't use an Html= on a variable in the annotate dataset, it has to be in the response dataset. But it seems the response dataset only will use the variable for the area. Has anyone had this problem before and know how to resolve it?

1 ACCEPTED SOLUTION

Accepted Solutions
rcleven2
Obsidian | Level 7

In proc gmap, the html= option must reference a variable in the response data set (example: name). That variable must be created with specifying a 'title=' before the actual text you want to appear as pop up text (example: name='title=' !! first;). HOWEVER, using this option in the proc gmap procedure seems to only label that boundaries on the map and not the separately annotated dots that I geocoded and plotted in an annotate dataset.

 

For that there must be a variable name HTML in the annotate data set and it has to be created by specifying HTML='title=' !! name; and the html= option needs to be removed from proc gmap. This has solved my biggest problem however, now if there is a space in the variable it acts as a delimiter and will cut off what pops up as text. So is name is Jeff Smith only Jeff pops up. But I am working on that now.

View solution in original post

3 REPLIES 3
ballardw
Super User

@rcleven2 wrote:

 

Why is it that proc gmap procedure relegates the html= option to an area on the map and not the dot I want plotted? I can't use an Html= on a variable in the annotate dataset, it has to be in the response dataset. But it seems the response dataset only will use the variable for the area. Has anyone had this problem before and know how to resolve it?


Because it is tied to the MAP data as identified by the ID value. Annotate is NOT map data. It can be used to generate "legend" text and symbols, grid lines, and text that does not appear inside the actual map graphic display area.

 

How big is the actual area you are displaying? If the area was a few counties you could likely create map data for a few locations though the projection and polygon coordinates may take some trial an error, and use the ID value(s) you add for these polygons.

 

Or perhaps learn to use the google maps API and license it.

rcleven2
Obsidian | Level 7

In proc gmap, the html= option must reference a variable in the response data set (example: name). That variable must be created with specifying a 'title=' before the actual text you want to appear as pop up text (example: name='title=' !! first;). HOWEVER, using this option in the proc gmap procedure seems to only label that boundaries on the map and not the separately annotated dots that I geocoded and plotted in an annotate dataset.

 

For that there must be a variable name HTML in the annotate data set and it has to be created by specifying HTML='title=' !! name; and the html= option needs to be removed from proc gmap. This has solved my biggest problem however, now if there is a space in the variable it acts as a delimiter and will cut off what pops up as text. So is name is Jeff Smith only Jeff pops up. But I am working on that now.

ballardw
Super User

@rcleven2 wrote:

 

For that there must be a variable name HTML in the annotate data set and it has to be created by specifying HTML='title=' !! name; and the html= option needs to be removed from proc gmap. This has solved my biggest problem however, now if there is a space in the variable it acts as a delimiter and will cut off what pops up as text. So is name is Jeff Smith only Jeff pops up. But I am working on that now.


Show how you are creating some of those values that get truncated and an example. I have created text that spanned multiple lines as popup text with multiple spaces. An example:

   my_html = 'title='||
            quote(Catx('0d'x,Countyname,
            '-----------------------------',
            ('Exemption Rate:     '||put(exempt_rate,f6.1)),
            ('Enrollment K, 1, 7: '||put(enrollment_sum,comma6.)),
            ('Students Exempt:    '||put(Total_Exempt_Sum,comma6.))
            )
   );

Which makes a variable that looks somewhat like:

 

title="Benewah
-----------------------------
Exemption Rate:        5.5
Enrollment K, 1, 7:    330
Students Exempt:        18"

the '0d'x is a linefeed to make the separate lines of data read as desired.

 

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