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

Hello, 

 

I am trying to map my data onto the Texas map. I divided the map into 11 publiic health regions. However, when I tried mapping my response data set only region 10 & 11 has the data on the map, the others remain blank.

 

I categorized the frequency counts using the proc format

 

My map code:

data texas_state;
set mapsgfk.us_counties;
where ID1='US-48';
if county in (43 109 141 229 243 377) then phr='10';
else;
if county in (7 25 47 61 131 215 247 249 261 273 297 311 355
391 409 427 479 489 505) then phr='11';
else
if county in (11 17 45 65 69 75 79 87 107 111 117 125 129 153 169 179 189 191 
195 205 211 219 233 269 279 295 303 305 341 345 357 359 369 375 381 393 421 
437 445 483 501) then phr='1'; 
else
if county in (9 23 49 59 77 83 93 101 133 151 155 197 207 237 253 263 275 
335 337 353 399 415 417 429 433 441 447 485 487 503) then phr='2';
else
if county in (85 97 113 121 139 143 147 181 221 231 251 257 349 363 367 
397 425 439 497) then phr='3';
else
if county in (1 37 63 67 73 119 159 183 203 213 223 277 315 343 365 379 
387 401 423 449 459 467 499) then phr='4';
else
if county in (5 199 225 241 245 347 351 361 373 403 405 407 419 455 457) then phr='5';
else
if county in (15 39 71 89 157 167 201 291 321 339 471 473 481) then phr='6';
else
if county in (21 27 31 35 41 51 53 55 99 145 149 161 185 193 209 217 281 287
289 293 299 309 313 331 333 395 411 453 477 491) then phr='7';
else
if county in (13 19 29 57 91 123 127 137 163 171 175 177 187 239 255 259 265 271 283 285
323 325 385 463 465 469 493 507) then phr='8';
else;
if county in (3 33 81 95 103 105 115 135 165 173 227 235 267 301 307 317 319 327 329 371
383 389 413 431 435 443 451 461 475 495) then phr='9';
run;
PROC CONTENTS DATA=texas_state;RUN;
* sort map data set in order by new geographic designation;
proc sort data= texas_state;
by phr;
run;
* eliminate county boundaries with HSA areas using PROC GREMOVE;
proc gremove
data= texas_state
out= texas_state_map;
by phr;
id county;
run;
PROC FORMAT;
VALUE count 
 500 - 999 = 'less than 1000'
 1000 - 2000 = 'Between 1000 and 2000'
 2001 - 3000 = '> 2000 but less than 3000'
 3001 - 4000 = '> 2000 but less than 3000'
 > 4000 = 'greater than 4000';run;
* fill patterns for the map areas (gray-scale fills);

PATTERN1 C = LightGreen;
PATTERN2 C = Cyan;
PATTERN3 C = Yellow;
PATTERN4 C = Orange;
PATTERN5 C = Red;
*sort by phr;
PROC SORT DATA = texas_state_map; BY phr;RUN;
PROC SORT DATA = YEAR1_REG; BY phr;RUN;

proc gmap
data=YEAR1_REG
map=texas_state_map
all;
id phr;
FORMAT count count.; choro count /statistic=first legend=legend1 discrete;run; quit;

My output map in attachment

 

Response dataset:

 

data WORK.YEAR1_REG;
infile datalines dsd truncover;
input phr:$2. COUNT:32.;
label COUNT="Frequency Count";
datalines;
1 844
2 1151
3 6169
4 2482
5 1785
6 6336
7 2609
8 5160
9 559
10 921
11 3837

 

Any help would be appreciated.

 

 
1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

@Zahrah wrote:

Hello, 

 

 

 

data WORK.YEAR1_REG;
infile datalines dsd truncover;
input phr:$2. COUNT:32.;
label COUNT="Frequency Count";
datalines;
1 844
2 1151
3 6169
4 2482
5 1785
6 6336
7 2609
8 5160
9 559
10 921
11 3837

 

Any help would be appreciated.

 

 

When I run your Work.Year1_reg code as posted count is always missing.

When I use this version:

data WORK.YEAR1_REG;
infile datalines  truncover;
input phr:$2. COUNT;
label COUNT="Frequency Count";
datalines;
1 844
2 1151
3 6169
4 2482
5 1785
6 6336
7 2609
8 5160
9 559
10 921
11 3837
;

I get all the areas populated and a map that looks like this using my defaults

 

gmap3.png

View solution in original post

4 REPLIES 4
PaigeMiller
Diamond | Level 26

You need to look at (with your own eyes) the data set TEXAS_STATE that you have created and see if the data in there is what you want, or not.

 

I suspect your variable PHR is not being correctly assigned, but there's no real way for me to know if that is true; you can know by looking at the data set with your own eyes.

--
Paige Miller
VDD
Ammonite | Level 13 VDD
Ammonite | Level 13

try it by removing the semicolon from this

else;

to this

else

 

we dont use semicolons after the else only at the end of the else statement

 

ballardw
Super User

@Zahrah wrote:

Hello, 

 

 

 

data WORK.YEAR1_REG;
infile datalines dsd truncover;
input phr:$2. COUNT:32.;
label COUNT="Frequency Count";
datalines;
1 844
2 1151
3 6169
4 2482
5 1785
6 6336
7 2609
8 5160
9 559
10 921
11 3837

 

Any help would be appreciated.

 

 

When I run your Work.Year1_reg code as posted count is always missing.

When I use this version:

data WORK.YEAR1_REG;
infile datalines  truncover;
input phr:$2. COUNT;
label COUNT="Frequency Count";
datalines;
1 844
2 1151
3 6169
4 2482
5 1785
6 6336
7 2609
8 5160
9 559
10 921
11 3837
;

I get all the areas populated and a map that looks like this using my defaults

 

gmap3.png

Zahrah
Fluorite | Level 6

Thank you everyone for your response. Thank you Ballardw. It worked:) 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 4 replies
  • 756 views
  • 2 likes
  • 4 in conversation