I have imported mapping data for the UK from ESRI shape files using Proc MapImport, which worked very well. I then ran the mapping data through Proc Greduce to get a density variable for quicker mapping - which also worked well. I then use Proc Gmap with the choro statement to produce my map along with tooltips hovering over areas and the ability to click and drill down for lower level maps. This all mostly works, but my problem is that some of the areas in my map seem to be undefined or have errors. I can hover over most areas and get a tooltip, and the pointer turns to a finger indicating I can drill down. However when I hover over just a few areas on the map the pointer does not change, I get no tooltip and cant click to drill down. I am using IE6, although I did just try this in Chrome and the problem is still there.
Has anyone seen this behavior before and does anyone have any idea how to fix or get a workaround?
Sounds like you're on the right track ... hopefully just a few steps away!
If you run your code on the original map (before greduce), do the charttips work any better?
Are you using dev=activex, dev=java, or dev=png (or gif)? I recommend trying it with dev=png (or gif) ... activex and java can have some special 'quirks' (or extra features) when it comes to custom charttips & drilldowns.
Are you 100% certain that your response data has good/valid values for all the map areas? None of the strings are getting truncated short (before the closing quote within the string)?
Also, in v9.3, "proc mapimport" doesn't allow you to specify an 'id' variable, therefore it has to 'guess/intuit' what the id variable (and segment variable) are in the map. In v9.2, mapimport was enhanced to let you specify exactly which variable is the unique id, and it also has some other improvements. If possible, try upgrading to v9.2 and try the import again (or maybe ask a friend who already has 9.2 to import the map for you, and then you can use that imported map in your v9.1.3 SAS session).
My guess, based on the symptoms, is that it is the MAPIMPORT ID issue.
It may be that the id you are chosing for GMAP is not really a unique ID for the polygons.
You can try to find if there is a better ID variable by MAPIMPORTing the data with no restrictions (take everything in the shapefile) and then open the data set and see if there are any other choices that might be unique.
It is also possible that there is no unique ID variable in the shapefile data or that the unique variable isn't useful or the one you want. This was a common problem with US Census ZCTA data. The ZCTA variable isn't unique. The ID statement added at 9.2 re-sorts the data so that that variable is unique.
You're a genius Darrell! (You too Rob ) I took my shape files along to SAS 9.2 and imported them whilst also specifying the id I wanted, then took the coordinates back to 9.1.3 and suddenly everything worked. This is great since I am doing this for the UK government's Census Management Information System that I am building. I'll tell the deputy directors that you helped. Thanks, Phil
I used SAS 9.2 to import the shape files, as Darrell suggested, which worked for all of the higher levels of geography.
I then got a shape file for a lower level and went through the same process and now find that I have a crazy looking shape. Looking at the coordinates it is a bit like it draws lines up and down like a heart monitor and then finally connects the last dot to the first one. This produces a series of triangles since all the ups and downs are bisected by the line back to the first coordinate. Is this likely to be bad shape data? Or is there something else I should do as I use Proc Mapimport to sort this problem out?
Thanks guys - once again the first thing you suggest turns out to be the solution. I was doing a SQL join with some other data on the map dataset, so that I could use a where and cut down the map data being used. This SQL join changed the sequence and messed things up. I just created a variable called obs which I set to _n_ in a data step, so I could remember the sequence of points - then I put an order by obs on my SQL join and it all worked. Thanks!
I've written a little example that might demonstrate the problem you're having ...
In this case, I declare the length of the html= variable too short, and it truncates the string (for some of the longer values, such as 'North Carolina') and therefore the charttips/drilldowns for just those areas with long-ish text don't work.
Often times, if you don't specify a length, SAS will choose one for you, and then later you might try to stuff a longer value into it (and, of course, the length of the string can't dynamically increase, so it truncates it!)
filename odsout '.';
create table foo as select unique state from maps.us;
data foo; set foo;
length myhtml $45;
ODS LISTING CLOSE;
ODS HTML path=odsout body="&name..htm";
title1 "Charttip for long names is truncated and doesn't work";
proc gmap map=maps.us data=foo;
choro state / levels=1 coutline=gray nolegend html=myhtml