My code:
goptions reset=all border;
proc format;
value p_hat
.326471921 - 1 = 'Top 10%'
0.053601524 - .32647192 = '75 - 90th percentile'
0.013562596 - 0.053601523 = '50 - 75th percentile'
0.005348746 - 0.013562595 = '25 - 50th percentile'
0.002584671 - 0.005348745 = '10 - 25th percentile'
0 - 0.00258467 = 'Bottom 10%';
run;
proc gmap map=maps.uscounty data=sav.map_set_lag_2014 anno=state_outline all;
id state county;
choro p_hat/ coutline=gray cdefault=degb statistic=first levels=6;
label p_hat = "Accuracy weighted model probabilities";
format p_hat p_hat.;
run;
quit;
Could somebody explain why my format is repeating itself in my legend? I tried to upload the map itself so you can see what I mean, but am unable to. Essentially the levels of P_hat are explained as I set in my proc format with he same number of levels, however the descriptions are including the next level in each color. Example: lightest color "Bottom 10% - 10 - 25th percentile"
next color "10 - 25th percentile - 25 - 50th percentile"
and so on.
Try DISCRETE instead of LEVELS.
From documentation:
generates a separate response level (color and surface pattern) for each different value of the formatted response variable.
(emphasis added)
If you specify the LEVELS= option, then a color ramp is used to assign each response value a continuous color scheme.
So your use of Levels=6 created basically 6 uniform width groups first, then displayed format assigned to that grouping.
For the posting of the image: You need to find where you output generated the PNG (or other format image files, possibly in your Work library) and use the Camera icon to browse to that location to upload the image.
@montgomerybarre wrote:
My code:
goptions reset=all border;
proc format;
value p_hat
.326471921 - 1 = 'Top 10%'
0.053601524 - .32647192 = '75 - 90th percentile'
0.013562596 - 0.053601523 = '50 - 75th percentile'
0.005348746 - 0.013562595 = '25 - 50th percentile'
0.002584671 - 0.005348745 = '10 - 25th percentile'
0 - 0.00258467 = 'Bottom 10%';
run;proc gmap map=maps.uscounty data=sav.map_set_lag_2014 anno=state_outline all;
id state county;
choro p_hat/ coutline=gray cdefault=degb statistic=first levels=6;
label p_hat = "Accuracy weighted model probabilities";
format p_hat p_hat.;
run;
quit;
Could somebody explain why my format is repeating itself in my legend? I tried to upload the map itself so you can see what I mean, but am unable to. Essentially the levels of P_hat are explained as I set in my proc format with he same number of levels, however the descriptions are including the next level in each color. Example: lightest color "Bottom 10% - 10 - 25th percentile"
next color "10 - 25th percentile - 25 - 50th percentile"
and so on.
Try DISCRETE instead of LEVELS.
From documentation:
generates a separate response level (color and surface pattern) for each different value of the formatted response variable.
(emphasis added)
If you specify the LEVELS= option, then a color ramp is used to assign each response value a continuous color scheme.
So your use of Levels=6 created basically 6 uniform width groups first, then displayed format assigned to that grouping.
For the posting of the image: You need to find where you output generated the PNG (or other format image files, possibly in your Work library) and use the Camera icon to browse to that location to upload the image.
@montgomerybarre wrote:
My code:
goptions reset=all border;
proc format;
value p_hat
.326471921 - 1 = 'Top 10%'
0.053601524 - .32647192 = '75 - 90th percentile'
0.013562596 - 0.053601523 = '50 - 75th percentile'
0.005348746 - 0.013562595 = '25 - 50th percentile'
0.002584671 - 0.005348745 = '10 - 25th percentile'
0 - 0.00258467 = 'Bottom 10%';
run;proc gmap map=maps.uscounty data=sav.map_set_lag_2014 anno=state_outline all;
id state county;
choro p_hat/ coutline=gray cdefault=degb statistic=first levels=6;
label p_hat = "Accuracy weighted model probabilities";
format p_hat p_hat.;
run;
quit;
Could somebody explain why my format is repeating itself in my legend? I tried to upload the map itself so you can see what I mean, but am unable to. Essentially the levels of P_hat are explained as I set in my proc format with he same number of levels, however the descriptions are including the next level in each color. Example: lightest color "Bottom 10% - 10 - 25th percentile"
next color "10 - 25th percentile - 25 - 50th percentile"
and so on.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.