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

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.

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

Try DISCRETE instead of LEVELS.

 

From documentation:

DISCRETE

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.


 

 

View solution in original post

2 REPLIES 2
ballardw
Super User

Try DISCRETE instead of LEVELS.

 

From documentation:

DISCRETE

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.


 

 

montgomerybarre
Obsidian | Level 7
ballardw, right again. Indebted to your services to the SAS community.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 2 replies
  • 278 views
  • 1 like
  • 2 in conversation