![]() | ![]() | ![]() | ![]() | ![]() |
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
The graphics output in the Results tab was produced using SAS 9.2. Submitting the sample code with releases prior to SAS 9.2 might produce different results.
/* This sample writes its output to C:\TEMP */
/* when run on the Windows operating system. */
/* Modify the destination on the FILENAME */
/* statements below if you want to write the */
/* output to a location other than C:\TEMP */
/* or if you are running on an operating */
/* system other than Windows. */
/* Designate a GIF file for the GMAP output. */
filename animmap 'c:\temp\g25609.gif';
/* Designate an HTML output file. */
filename htmlfile 'c:\temp\g25609.html';
/* Define a macro variable that points to the */
/* GMAP output. Use the path and file name */
/* that you specified for the fileref of */
/* ANIMMAP above. */
%let mapsrc=c:\temp\g25609.gif;
/* Set the graphics environment, making sure */
/* to use the GIFANIM device driver */
goptions reset=all dev=gifanim gsfmode=replace
gsfname=animmap xpixels=600 ypixels=400
iteration=0 delay=150
disposal=background htext=11pt htitle=12pt
border;
/* Create the HTML file that will display the */
/* GIF animation. */
data _null_;
file htmlfile;
source=quote("&mapsrc");
put '<HTML>';
put '<BODY>';
put '<BLOCKQUOTE>';
put '<P><img src=' source
' alt="NC Population Growth"></P>';
put '</BLOCKQUOTE>';
put '</BODY>';
put '</HTML>';
/* Generate sample data */
data NCPop;
length Name $ 32;
input State County P1990 P1980 P1970 P1960
P1950 / P1940 P1930 P1920 P1910 P1900 /
AreaLand AreaWater / X Y / Name &;
SquareMiles = AreaLand * 0.000386102158496;
Pop1900 = P1900 / SquareMiles;
Pop1910 = P1910 / SquareMiles;
Pop1920 = P1920 / SquareMiles;
Pop1930 = P1930 / SquareMiles;
Pop1940 = P1940 / SquareMiles;
Pop1950 = P1950 / SquareMiles;
Pop1960 = P1960 / SquareMiles;
Pop1970 = P1970 / SquareMiles;
Pop1980 = P1980 / SquareMiles;
Pop1990 = P1990 / SquareMiles;
label
Pop1900 = '1900 Population Per Square Mile'
Pop1910 = '1910 Population Per Square Mile'
Pop1920 = '1920 Population Per Square Mile'
Pop1930 = '1930 Population Per Square Mile'
Pop1940 = '1940 Population Per Square Mile'
Pop1950 = '1950 Population Per Square Mile'
Pop1960 = '1960 Population Per Square Mile'
Pop1970 = '1970 Population Per Square Mile'
Pop1980 = '1980 Population Per Square Mile'
Pop1990 = '1990 Population Per Square Mile';
format P1990 P1980 P1970 P1960 P1950 P1940 P1930
P1920 P1910 P1900 comma8.;
label P1990 = '1990 Population'
P1980 = '1980 Population'
P1970 = '1970 Population'
P1960 = '1960 Population'
P1950 = '1950 Population'
P1940 = '1940 Population'
P1930 = '1930 Population'
P1920 = '1920 Population'
P1910 = '1910 Population'
P1900 = '1900 Population';
datalines;
37 1 108213 99319 96362 85674 71220
57427 42140 32718 28712 25665
1115485 10649
-79.398440 36.043667
Alamance County
37 3 27544 24999 19466 15625 14554
13454 12922 12212 11592 10960
674244 7682
-81.176957 35.921840
Alexander County
37 5 9590 9587 8134 7734 8155
8341 7186 7403 7745 7759
607822 2184
-81.130166 36.494291
Alleghany County
37 7 23474 25649 23488 24962 26781
28443 29349 28334 25465 21870
1376877 14395
-80.102273 34.974665
Anson County
37 9 22209 22325 19571 19768 21878
22664 21019 21001 19074 19581
1103759 1678
-81.501738 36.433061
Ashe County
37 11 14867 14409 12655 12009 13352
13561 11803 10335 . .
639765 527
-81.923096 36.078677
Avery County
37 13 42283 40355 35980 36014 37134
36431 35026 31024 30877 26404
2143508 337704
-76.844806 35.482730
Beaufort County
37 15 20388 21024 20528 24350 26439
26201 25844 23993 23039 20538
1811023 108725
-76.963026 36.059078
Bertie County
37 17 28663 30491 26477 28881 29703
27156 22389 19761 17926 17677
2266291 31435
-78.555913 34.619414
Bladen County
37 19 50985 35777 24223 20278 19238
17125 15818 14876 14432 12657
2214234 505472
-78.221373 34.038591
Brunswick County
37 21 174821 160934 145056 130074 124403
108755 97937 64148 49798 44288
1699771 9757
-82.530302 35.609250
Buncombe County
37 23 75744 72504 60364 52701 45518
38615 29410 23297 21408 17699
1312474 21151
-81.705546 35.747224
Burke County
37 25 98935 85895 74629 68137 63783
59393 44331 33730 26240 22456
943870 1535
-80.550624 35.387719
Cabarrus County
37 27 70709 67746 56699 49552 43352
35795 28016 19984 20579 15694
1221648 6857
-81.546710 35.954179
Caldwell County
37 29 5904 5829 5453 5598 5223
5440 5461 5382 5640 5474
623401 168412
-76.162635 36.337433
Camden County
37 31 52556 41092 31603 30940 23059
18284 16900 15384 13776 11811
1376252 2124325
-76.504367 34.876340
Carteret County
37 33 20693 20705 19055 19912 20870
20032 18214 15759 14858 15028
1102645 7094
-79.334978 36.395774
Caswell County
37 35 118412 105208 90873 73191 61794
51653 43991 33839 27918 22133
1035959 35069
-81.214447 35.663000
Catawba County
37 37 38759 33415 29554 26785 25392
24726 24177 23814 22635 23912
1769175 67596
-79.257916 35.701627
Chatham County
37 39 20170 18933 16330 16335 18294
18813 16151 15242 14136 11860
1178976 29753
-84.063943 35.137053
Cherokee County
37 41 13506 12558 10764 11729 12540
11572 11282 10649 11303 10258
447129 157166
-76.602214 36.130582
Chowan County
37 43 7155 6619 5180 5526 6006
6405 5434 4646 3909 4532
556088 15269
-83.755775 35.058290
Clay County
37 45 84714 83435 72556 66048 64357
58055 51914 34272 29494 25078
1202650 10277
-81.555983 35.335821
Cleveland County
37 47 49587 51037 46937 48973 50621
45663 37720 30124 28020 21274
2426420 43501
-78.665189 34.260273
Columbus County
37 49 81613 71043 62554 58773 48823
31298 30665 29048 25594 24160
1801481 171621
-77.082063 35.120364
Craven County
37 51 274566 247160 212042 148418 96006
59320 45219 35064 35284 29249
1691602 13913
-78.828669 35.046496
Cumberland County
37 53 13736 11089 6976 6601 6201
6709 6710 7268 7693 6529
677819 683689
-75.943940 36.364223
Currituck County
37 55 22746 13377 6995 5935 5405
6041 5202 5115 4841 4757
988529 3055997
-75.726973 35.689903
Dare County
37 57 126677 113162 95627 79493 62244
53377 47865 35201 29404 23403
1430279 37760
-80.212050 35.793988
Davidson County
37 59 27859 24599 18855 16728 15420
14909 14386 13578 13394 12115
686892 4357
-80.542744 35.929728
Davie County
37 61 39995 40952 38015 40270 41074
39739 35103 30223 25442 22405
2118185 3408
-77.934958 34.936280
Duplin County
37 63 181835 152785 132681 111995 101639
80244 67196 42219 35276 26233
752731 19387
-78.874855 36.037733
Durham County
37 65 56558 55988 52341 54226 51634
49162 47894 37995 32010 26591
1308117 3999
-77.596413 35.913972
Edgecombe County
37 67 265878 243683 214348 189428 146135
126475 111681 77269 47311 35261
1061038 8408
-80.256884 36.130100
Forsyth County
37 69 36414 30055 26820 28755 31341
30382 29456 26667 24692 25116
1273230 6610
-78.284402 36.078542
Franklin County
37 71 175093 162568 148415 127074 110836
87531 78093 51242 37063 27903
923415 18952
-81.181376 35.295733
Gaston County
37 73 9305 8875 8524 9254 9555
10060 10551 10537 10455 10413
882234 12939
-76.703036 36.441682
Gates County
37 75 7196 7217 6562 6432 6886
6418 5841 4872 4749 4343
756477 24687
-83.832761 35.348981
Graham County
37 77 38345 34043 32762 33110 31793
29344 28723 26846 25102 23263
1375727 14064
-78.656475 36.304616
Granville County
37 79 15384 16117 14967 16741 18024
18548 18656 16212 13083 12038
687510 1192
-77.684095 35.486406
Greene County
37 81 347420 317154 288590 246520 191057
153916 133010 79272 60497 39074
1683839 19678
-79.788578 36.078650
Guilford County
37 83 55516 55286 53884 58956 58377
56512 53246 43766 37646 30793
1878900 14312
-77.656287 36.256365
Halifax County
37 85 67822 59570 49667 48236 47605
44239 37911 28313 22174 15988
1541157 16219
-78.864479 35.370721
Harnett County
37 87 46942 46495 41710 39711 37631
34804 28273 23496 21020 16222
1434538 2488
-82.978472 35.552912
Haywood County
37 89 69285 58580 42804 36163 30921
26049 23404 18248 16262 14104
968251 2606
-82.481060 35.336677
Henderson County
37 91 22523 23368 23529 22718 21453
19352 17542 16294 15436 14294
916007 18555
-76.983549 36.357722
Hertford County
37 93 22856 20383 16436 16356 15756
14937 14244 11722 . .
1013335 2891
-79.233597 35.020731
Hoke County
37 95 5411 5873 5571 5765 6479
7860 8550 8386 8840 9278
1587217 2100950
-76.153167 35.406175
Hyde County
37 97 92931 82538 72197 62526 56303
50424 46693 37956 34315 29064
1487705 49259
-80.872852 35.808938
Iredell County
37 99 26846 25811 21593 17780 19261
19366 17519 13396 12998 11853
1270602 9792
-83.144428 35.287913
Jackson County
37 101 81306 70599 61737 62936 65906
63798 57621 48998 41401 32250
2051232 10157
-78.365188 35.519144
Johnston County
37 103 9414 9705 9779 11005 11004
10926 10428 9912 8721 8226
1225854 3735
-77.366004 35.012274
Jones County
37 105 41374 36718 30467 26561 23522
18743 16996 13400 11376 .
666368 5371
-79.172288 35.476112
Lee County
37 107 57274 59819 55204 55276 45953
41211 35716 29555 22769 18639
1035668 5792
-77.642804 35.241504
Lenoir County
37 109 50319 42372 32682 28814 27459
24187 22872 17862 17132 15498
773937 21336
-81.222868 35.484317
Lincoln County
37 111 35681 35135 30648 26742 25720
22996 20336 16763 13538 12567
1144003 12260
-82.048316 35.682170
McDowell County
37 113 23499 20178 15788 14935 16174
15880 13672 12887 12191 12104
1337622 7739
-83.420551 35.149662
Macon County
37 115 16953 16827 16003 17217 20522
22522 20306 20083 20132 20644
1164065 5616
-82.711605 35.858222
Madison County
37 117 25078 25948 24730 27139 27938
26111 23400 20828 17797 15383
1198098 802
-77.102793 35.843384
Martin County
37 119 511433 404270 354656 272111 197052
151826 127971 80695 67031 55268
1366029 57783
-80.833124 35.248300
Mecklenburg County
37 121 14433 14428 13447 13906 15143
15980 13962 11278 17245 15221
573618 1756
-82.164023 36.013505
Mitchell County
37 123 23346 22469 19267 18408 17260
16280 16218 14607 14967 14197
1271846 25995
-79.902750 35.329501
Montgomery County
37 125 59013 50505 39048 36733 33129
30969 28215 21388 17010 23622
1809768 19519
-79.484951 35.308882
Moore County
37 127 76677 67153 59122 61002 59919
55608 52782 41061 33727 25478
1399438 6213
-77.988153 35.968403
Nash County
37 129 120284 103471 82996 71742 63272
47935 43010 40620 32037 25785
515261 334081
-77.864928 34.182267
New Hanover County
37 131 20798 22584 24009 26811 28432
28299 27161 23184 22323 21150
1388609 36569
-77.397564 36.419492
Northampton County
37 133 149838 112784 103126 82706 42047
17939 15289 14703 14125 11940
1986186 366723
-77.413151 34.714503
Onslow County
37 135 93851 77055 57707 42970 34435
23072 21171 17895 15064 14690
1035451 3521
-79.118108 36.059176
Orange County
37 137 11372 10398 9467 9850 9993
9706 9299 9060 9966 8045
872693 593875
-76.667599 35.150317
Pamlico County
37 139 31298 28462 26824 25630 24347
20568 19143 17670 16693 13660
587655 162027
-76.261902 36.264968
Pasquotank County
37 141 28855 22215 18149 18508 18423
17710 15686 14788 15471 13381
2255159 160503
-77.887412 34.510260
Pender County
37 143 10447 9486 8351 9178 9602
9773 10668 11137 11054 10091
640211 211768
-76.413974 36.181163
Perquimans County
37 145 30180 29164 25914 26394 24361
25029 22039 18973 17356 16685
1016170 30456
-78.976731 36.392005
Person County
37 147 107924 90146 73900 69942 63789
61244 54466 45569 36340 30889
1687701 8267
-77.376724 35.590834
Pitt County
37 149 14416 12984 11735 11395 11627
11874 10216 8832 7640 7004
615999 1933
-82.166223 35.277434
Polk County
37 151 106546 91728 76358 61497 50804
44554 36259 30856 29491 28232
2039544 6487
-79.806454 35.710853
Randolph County
37 153 44518 45481 39889 39202 39597
36810 34016 25567 19673 15855
1227766 14504
-79.746604 35.002992
Richmond County
37 155 105179 101610 84842 89102 87769
76860 66512 54674 51945 40371
2457654 5630
-79.107083 34.640290
Robeson County
37 157 86064 83426 72402 69629 64816
57898 51083 44149 36442 33163
1467166 15228
-79.777045 36.395222
Rockingham County
37 159 110605 99186 90035 82817 75410
69206 56665 44062 37521 31066
1324532 32352
-80.522881 35.635940
Rowan County
37 161 56918 53787 47337 45091 46356
45577 40452 31426 28385 25101
1461330 4561
-81.919825 35.399004
Rutherford County
37 163 47297 49687 44954 48013 49780
47440 40082 36002 29982 26380
2448889 5168
-78.368650 34.991474
Sampson County
37 165 33754 32273 26929 25183 26336
23232 20174 15600 15363 12553
826631 3864
-79.480268 34.841482
Scotland County
37 167 51765 48517 42822 40873 37130
32834 30216 27429 19909 15220
1023305 23823
-80.253246 35.312435
Stanly County
37 169 37223 33086 23782 22314 21520
22656 22290 20575 20151 19866
1170296 10487
-80.229627 36.409127
Stokes County
37 171 61704 59449 51415 48205 45593
41783 39749 32464 29705 25515
1389690 3246
-80.686903 36.415407
Surry County
37 173 11268 10283 7861 8387 9921
12177 11568 13224 10403 8401
1367858 32432
-83.492172 35.492370
Swain County
37 175 25520 23417 19713 16372 15194
12241 9589 9303 7191 6620
979927 5724
-82.797132 35.198385
Transylvania County
37 177 3856 3975 3806 4520 5048
5556 5164 4849 5219 4980
1009930 544887
-76.165131 35.870394
Tyrrell County
37 179 84211 70380 54714 44670 42034
39097 40979 36029 33277 27156
1650918 5753
-80.533324 34.988079
Union County
37 181 38892 36748 32691 32002 32101
29961 27294 22799 19425 16684
656683 42224
-78.405165 36.364666
Vance County
37 183 423380 301327 228453 169082 136450
109544 94757 75155 63229 54626
2159843 61089
-78.650425 35.789933
Wake County
37 185 17265 16232 15810 19652 23539
23145 23364 21593 20266 19151
1110461 39034
-78.097308 36.397658
Warren County
37 187 13997 14801 14038 13488 13180
12323 11603 11429 11062 10608
900914 197908
-76.564706 35.836810
Washington County
37 189 36952 31666 23404 17529 18342
18114 15165 13477 13556 13417
809489 530
-81.696969 36.233549
Watauga County
37 191 104666 97054 85408 82059 64267
58328 53013 43640 35698 31356
1431237 10674
-78.004614 35.362320
Wayne County
37 193 59393 58657 49524 45269 45243
43003 36162 32644 30282 26872
1961207 7087
-81.165682 36.203051
Wilkes County
37 195 66061 63132 57486 57716 54506
50219 44914 36813 28269 23596
961133 8272
-77.919105 35.704817
Wilson County
37 197 30488 28439 24599 22804 22133
20657 18010 16391 15428 14083
869241 4950
-80.665192 36.158264
Yadkin County
37 199 15419 14934 12629 14008 16306
17202 14486 15093 12072 11464
809243 1752
-82.310012 35.902682
Yancey County
run;
/* Extract the NC data from the Counties map */
/* data in the MAPS library. */
data NCC;
set Maps.Counties;
where State = 37 and Density <= 3;
run;
proc gproject data=NCC out=NCCounty;
id State County;
run;
/* Produce a color ramp in temp.sas and use the */
/* file to generate PATTERN statements. */
data _null_;
file 'c:\temp\temp.sas';
r = 224; rinc = -r/100;
g = 176; ginc = -g/100;
b = 160; binc = -b/100;
do i = 1 to 99;
put 'pattern' i ' v=s c=cx' r hex2. g hex2.
b hex2. ';';
r + rinc;
g + ginc;
b + binc;
end;
run;
%inc 'c:\temp\temp.sas';
data a;
length color function $ 8 text $ 20 style $ 20;
retain xsys ysys '3' when 'A' style 'S';
r = 224; rinc = -r/100;
g = 176; ginc = -g/100;
b = 160; binc = -b/100;
x = 25; xinc = 0.5;
do i = 1 to 99;
color = 'cx' ||
put( r, hex2. ) ||
put( g, hex2. ) ||
put( b, hex2. );
function = 'MOVE';
y = 5;
output;
function = 'BAR';
x + xinc;
y = 10;
output;
r + rinc;
g + ginc;
b + binc;
end;
function = 'LABEL';
Style = "'Albany AMT'";
Text = '800 people/square mile';
Position = '6';
x + xinc;
y = 7.5;
output;
Text = '1';
Position = '4';
x = 24.5;
y = 7.5;
output;
run;
/* Set the title and legend. */
title1 'North Carolina Population 1900-1990';
legend1 frame label=(position=(top center));
/* Generate the multiple images that */
/* make up the GIF animation. */
proc gmap map=NCCounty data=NCPop anno=a;
id State County;
title2 h=12pt '1900';
choro Pop1900 /
midpoints=8 to 792 by 8 coutline=black
nolegend;
run;
/* Suppress header information and begin */
/* appending additional images. */
goption gsfmode=append;
title2 h=12pt '1910';
choro Pop1910 /
midpoints=8 to 792 by 8 coutline=black
nolegend;
run;
title2 h=12pt '1920';
choro Pop1920 /
midpoints=8 to 792 by 8 coutline=black
nolegend;
run;
title2 h=12pt '1930';
choro Pop1930 /
midpoints=8 to 792 by 8 coutline=black
nolegend;
run;
title2 h=12pt '1940';
choro Pop1940 /
midpoints=8 to 792 by 8 coutline=black
nolegend;
run;
title2 h=12pt '1950';
choro Pop1950 /
midpoints=8 to 792 by 8 coutline=black
nolegend;
run;
title2 h=12pt '1960';
choro Pop1960 /
midpoints=8 to 792 by 8 coutline=black
nolegend;
run;
title2 h=12pt '1970';
choro Pop1970 /
midpoints=8 to 792 by 8 coutline=black
nolegend;
run;
title2 h=12pt '1980';
choro Pop1980 /
midpoints=8 to 792 by 8 coutline=black
nolegend;
run;
/* Mark the end of the animation by */
/* appending a GIF trailer to the */
/* data stream. */
goptions gepilog='3B'x;
/* Generate the final image. */
title2 h=12pt '1990';
choro Pop1990 /
midpoints=8 to 792 by 8 coutline=black
nolegend;
run;
quit;
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
This code produces HTML output. Click here to view the output.
| Type: | Sample |
| Topic: | Third Party ==> Output ==> Device Drivers ==> GIFANIM SAS Reference ==> Procedures ==> GDEVICE SAS Reference ==> Procedures ==> GPROJECT SAS Reference ==> Procedures ==> GMAP |
| Date Modified: | 2005-09-22 03:03:16 |
| Date Created: | 2005-05-23 14:18:45 |
| Product Family | Product | Host | SAS Release | |
| Starting | Ending | |||
| SAS System | SAS/GRAPH | All | 9.1 TS1M0 | n/a |




