Type : SASHELP_ET_CREATION_INTERNE
Die Beispiele verwenden die SASHELP.MAPS-Bibliotheken (MAPS.STATES, MAPS.USCENTER) und einen internen Datensatz 'scoreperstate', der über einen DATA-Schritt für die Autonomie des Beispiels erstellt wurde.
| 1 | DATA work.scoreperstate; |
| 2 | LENGTH state_fips $2.; |
| 3 | INPUT state_fips $ _Score_ numeric; |
| 4 | DATALINES; |
| 5 | 01 700 |
| 6 | 02 650 |
| 7 | 04 720 |
| 8 | 05 680 |
| 9 | 06 750 |
| 10 | 08 690 |
| 11 | 09 710 |
| 12 | 10 730 |
| 13 | 11 670 |
| 14 | 12 700 |
| 15 | 13 740 |
| 16 | 16 680 |
| 17 | 17 720 |
| 18 | 18 700 |
| 19 | 19 690 |
| 20 | 20 730 |
| 21 | 21 710 |
| 22 | 22 700 |
| 23 | 23 680 |
| 24 | 24 720 |
| 25 | 25 710 |
| 26 | 26 700 |
| 27 | 27 690 |
| 28 | 28 730 |
| 29 | 29 700 |
| 30 | 30 680 |
| 31 | 31 720 |
| 32 | 32 710 |
| 33 | 33 700 |
| 34 | 34 690 |
| 35 | 35 730 |
| 36 | 36 710 |
| 37 | 37 700 |
| 38 | 38 680 |
| 39 | 39 720 |
| 40 | 40 710 |
| 41 | 41 700 |
| 42 | 42 690 |
| 43 | 44 730 |
| 44 | 45 710 |
| 45 | 46 700 |
| 46 | 47 680 |
| 47 | 48 720 |
| 48 | 49 710 |
| 49 | 50 700 |
| 50 | 51 690 |
| 51 | 53 730 |
| 52 | 54 710 |
| 53 | 55 700 |
| 54 | 56 680 |
| 55 | ; |
| 56 | RUN; |
| 1 | DATA states; |
| 2 | SET maps.states; |
| 3 | IF state ^in(2,15,72); /* Exclut l'Alaska, Hawaï et Porto Rico */ |
| 4 | x = -x * 45/atan(1); /* Conversion de la longitude en degrés */ |
| 5 | y = y * 45/atan(1); /* Conversion de la latitude en degrés */ |
| 6 | RUN; |
| 1 | DATA plot_data; |
| 2 | SET maps.uscenter; |
| 3 | IF state ^in(2,15,72) and ocean^='Y'; |
| 4 | long = -long; |
| 5 | statename = fipstate(state); /* Récupère le code FIPS de l'état */ |
| 6 | state_fips = put(state, z2.); /* Crée une variable state_fips à partir de 'state' pour la jointure */ |
| 7 | RUN; |
| 1 | title 'Average Credit Score in Each State'; |
| 2 | footnote4 'Map only includes the lower 48 states in the United States'; |
| 3 |
| 1 | PROC SGMAP mapdata=work.states |
| 2 | maprespdata=work.scoreperstate /* Utilisation du jeu de données autonome */ |
| 3 | plotdata=work.plot_data; |
| 4 | |
| 5 | esrimap |
| 6 | url='http://services.arcgisonline.com/arcgis/rest/services/Canvas/World_Light_Gray_Base'; |
| 7 | |
| 8 | choromap _Score_ / mapid=state id=state_fips /* Utilisation de state_fips pour la jointure */ |
| 9 | density=1 |
| 10 | numlevels=4 leveltype=none |
| 11 | colormodel=( sty greenyellow deepskyblue cornflowerblue beige) |
| 12 | name='choro'; |
| 13 | |
| 14 | text x=long y=lat text=statename / |
| 15 | textattrs=(size=6pt); |
| 16 | gradlegend 'choro' / title='Average Credit Score' |
| 17 | extractscale; |
| 18 | |
| 19 | RUN; |
| 20 | |
| 21 | QUIT; |