BookmarkSubscribeRSS Feed
Anita_n
Pyrite | Level 9

Dear all,

am tring to create a map using sgmap. I realise the polygons are overlaping. I have being tring to findout what am doing wrong but haven't been successful. Please any help. Here is my code

proc sgmap mapdata=germany maprespdata=myplotdata rattrmap=rattrmap 
plotdata=myplotdata;

openstreetmap;
choromap sum_of_cases /mapid=id id=id transparency=0.5 leveltype=interval numlevels=4 attrid=myid name="map";

gradlegend "map" / position=right notitle;;
run;

and the result is attached:

 

Anita_n_0-1641412249508.png

 

I also get this warning:

WARNING: Some of the regions in the map contain multiple classification values. Only the first value is will be displayed.

13 REPLIES 13
sbxkoenk
SAS Super FREQ

Hello,

 

I am not a specialist with all that is "maps"-related.

But could it be that your problem is the same as the one that was described (and solved!) here?

 

How to remove extraneous lines in map of Mexico?
https://communities.sas.com/t5/Graphics-Programming/How-to-remove-extraneous-lines-in-map-of-Mexico/...

 

Koen

Anita_n
Pyrite | Level 9

Yes, its similar. Let me try that and see.

Thanks

Anita_n
Pyrite | Level 9

Dear all,

I wasn't sucessful with that solution. I will be glad if anyone can help

GraphGuy
Meteorite | Level 14

The error message probably means that your response dataset (maprespdata=myplotdata) has multiple response/choro values (sum_of_cases) for some of the map areas.

 

A 'quick fix' might be to do something like this, and use the new dataset:

 

proc sql noprint;

create table myplotdata_unique as

select unique id, sum_of_cases

from myplotdata;

quit; run;

 

But you should really investigate and determine why you have multiple observations for your id's.

 

 

Anita_n
Pyrite | Level 9

@sbxkoenk I could solve the problem this way;

 

proc sql;
create table germany_rlp as select a.*, b.idname from mapsgfk.germany(drop=x y) a natural join mapsgfk.germany_attr b
where id1 = "DE-07";

create table respdat_rlp as select id as id, mean(long) as longc, mean(lat) as latc, min(idname) as idname from 
germany_rlp group by id;
quit;

proc sgmap mapdata=germany_rlp maprespdata=respdat_rlp plotdata=myplotdat;
openstreetmap;
choromap/ mapid=id;
bubble x=longc y=latc size= no_of_cases/ bradiusmin=2px bradiusmax=10px datalabel=idname 
datalabelattrs=(color=red size=3px style=italic);
run;

this is the result I got

 

Anita_n_0-1641559911691.png

My question is how can I make the selected region larger to cover a larger area of the map

GraphGuy
Meteorite | Level 14

The background map area is automatically selected to accommodate all the map areas and bubbles you're drawing. Therefore you'll need to eliminate the 'bubbles' from your data, in the areas you do not want to show.

Anita_n
Pyrite | Level 9

@GraphGuy  actually I will like to display those outside the selected region also but the emphasis is on the selected region

something similar to this. Just that the bubbles can also be outside the selected region

 

Anita_n_0-1641571356953.png

 

GraphGuy
Meteorite | Level 14

Keep the bubbles for the areas of the map you want shown.

Delete the bubbles out of your dat for the areas of the map you do not want shown.

There is no other way provided to subset/restrict the area of the background map shown.

 

Anita_n
Pyrite | Level 9

ok, thanks. I will try that

Anita_n
Pyrite | Level 9

 

 

GraphGuy
Meteorite | Level 14

Perhaps it would be better to open a separate topic/thread for each of your requests.

 

Anita_n
Pyrite | Level 9

Yes, I can , I thought It's all about the same graph. That is why I open just a a thread

Anita_n
Pyrite | Level 9

@GraphGuy I have opened two threads for that. I hope it's okay

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 13 replies
  • 1408 views
  • 0 likes
  • 3 in conversation