BookmarkSubscribeRSS Feed
AncaTilea
Pyrite | Level 9

Hi,

I am creating several US maps, and the response variable is continuous. I do this for a series of years.

I noticed that for different data, I need to use different MIDPOINTS options to make the categories correctly on the map.

Sometimes I need to use

MIDPOINTS = OLD RANGE

and sometimes

MIDPOINTS = 0 3 8 ...(or an exact set of values)

Could anyone explain the difference.

(I have read about MIDPOINTS, and all I found was that

Specifying MIDPOINTS=OLD generates default midpoints using the Nelder algorithm (Applied Statistics 25:94-7, 1976).  (SAS/GRAPH(R) 9.2: Reference, Second Edition)

Maybe someone can explain this a bit?

Thank you.

Anca.

6 REPLIES 6
GraphGuy
Meteorite | Level 14

Do you want the legends of all the maps to be the same, so you can compare them?

If I don't need the legends to be the same, and I basically want to "auto-scale" the legend, I just use levels=5

AncaTilea
Pyrite | Level 9

Yes, the legends should be the same.

GraphGuy
Meteorite | Level 14

If you want the legend ranges to be guaranteed to be the same in all the maps, you won't be able to just use the midpoints= option. Instead you'll need to manually determine which range each data point falls in (using a data step and 'if/else' statements), and put each into a 'bucket', and then use the midpoints= option to specify the buckets (to make sure they all show up in each map, regardless of whether there are any obsns in that bucket in that particular data). And you can use a user-defined-format to make the buckets print showing the legend ranges.

Here are some code snippets that might help get you started ...

proc format;
value buckfmt
1 = '1-7'
2 = '8-15'
3 = '16+'
;
run;

data my_data; set my_data;
format bucket buckfmt.;

if cases<=7 then bucket=1;
else if cases<=15 then bucket=2;
else if cases>=16 then bucket=3;

run;

proc gmap data=my_data map=maps.us all;

id statecode;

choro bucket / discrete midpoints=1 2 3;

run;

AncaTilea
Pyrite | Level 9

Thank you, Robert.

I guess my question was more geared towards understanding why when I defined specific values for the midpoints, the buckets seem to be ever so slightly off, but it gets fixed by MIDPOINTS = OLD RANGE option. And for other data it works like a charm (the midpoints = specific values).

Anca.

GraphGuy
Meteorite | Level 14

Unless you're dealing with discrete values (and using the discrete option), I think the midpoints= option is going to provide varying ranges in your legend (depending on what data you're plotting). I never truse the midpoints= option to choose my legend ranges.

data_null__
Jade | Level 19

RobertAllison@SAS wrote:

Instead you'll need to manually determine which range each data point falls

I have found the XML routine CALL GSCALE useful for data-driven uniform axis calculations.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 6 replies
  • 2301 views
  • 7 likes
  • 3 in conversation