ods html close; ods html file="output.html"; /* Get British Columbia Census divisions from here: https://www2.gov.bc.ca/gov/content/data/geographic-data-services/land-use/administrative-boundaries */ proc mapimport out=BC1 datafile="c:\canada\CD_2011.shp"; id cdname; run; /* The from parameter below was put together from the .prj file. To see a list of some of the .prj files and the values used below, see http://cfconventions.org/wkt-proj-4.html. When looking at the .prj file, here are the PROJ.4 values: +proj = PROJCS +dataum = DATUM +ellps = Spheroid +x_0 = False_Easting +y_0 = False_Northing +lon_0 = Central_Merdian +lat_0 = Latitude_Of_Origin +lat_1 = Standard_Parallel_1 +lat_2 = Standard_Parallel_2 +units = UNIT +no_defs Examples can be seen in sashelp.proj4def. */ proc gproject data=BC1 out=BC from="+proj=aea +datum=NAD83 +ellps=GRS80 +x_0=1000000.0 +y_0=0.0 +lon_0=-126.0 +lat_0=45.0 +lat_1=50.0 +lat_2=58.5 +units=m +no_defs" to="EPSG:4326"; /* always use EPSG:4236 for OSM and Esri */ id cdname; run; /* This is the beginning of the Esri URL */ %let url = http://services.arcgisonline.com/arcgis/rest/services; title1 "British Columbia Choromap with Projected Data"; proc sgmap mapdata=BC noautolegend; esrimap url="&url/Canvas/World_Light_Gray_Base"; choromap / mapid=cdname; run; /***********************************************************************/ /* Run PROC GREMOVE to remove the inner boundaries of British Columbia */ proc gremove data=BC out=BC_gremove; by pruid; id cdname; run; title1 "British Columbia choromap with No Internal Boundaries"; proc sgmap mapdata=BC_gremove noautolegend; esrimap url="&url/Canvas/World_Light_Gray_Base"; choromap / mapid=pruid; run; /*************************************************/ /* Use PROC GREDUCE to add the DENSITY variable */ /* to the map dataset with values 1 through 6. */ proc greduce data=BC_gremove out=BC_reduced; id pruid; run; /* Count the nuber of occurances for each density */ title1 "British Columbia Reduced Data, PROC GREDUCE defaults"; proc freq data=BC_reduced; table density / out=density_count; run; title1 "British Columbia with Reduced Data, PROC GREDUCE defaults"; proc sgmap mapdata=BC_reduced noautolegend; esrimap url="&url/Canvas/World_Light_Gray_Base"; choromap / mapid=pruid density=1; run; /* Try PROC GREDUCE and code the N-values */ proc greduce data=BC_gremove out=BC_reduced2 n1=100 n2=300 n3=500 n4=700 n5=900; id pruid; run; title1 "British Columbia with Reduced Data with N-values Set"; proc freq data=BC_reduced2; table density / out=density_count; run; title1 "British Columbia with Reduced Data, Density=1"; proc sgmap mapdata=BC_reduced2 noautolegend; esrimap url="&url/Canvas/World_Light_Gray_Base"; choromap / mapid=pruid density=1; run; title1 "British Columbia with Reduced Data, Density=2"; proc sgmap mapdata=BC_reduced2 noautolegend; esrimap url="&url/Canvas/World_Light_Gray_Base"; choromap / mapid=pruid density=2; run; /**********************************************************/ /* use PROC GPROJECT to only display the coastal area */ proc gproject data=BC_reduced2 out=BC_projected degrees /* input coordinates are degrees */ project=none /* do not project the output coordinates */ /*longmin= */ longmax=-123 /*latmin= */ latmax=56 ; id pruid; run; title1 "British Columbia Coast, Density=2"; proc sgmap mapdata=BC_projected noautolegend; esrimap url="&url/Canvas/World_Light_Gray_Base"; choromap / mapid=pruid density=2; run; title1 "British Columbia Coast, Density=3"; proc sgmap mapdata=BC_projected noautolegend; esrimap url="&url/Canvas/World_Light_Gray_Base"; choromap / mapid=pruid density=3; run; /**********************************************************/ /* use PROC GPROJECT to only display the coastal area */ /* with the original data */ proc gproject data=BC_gremove out=BC_projected2 degrees /* input coordinates are degrees */ project=none /* do not project the output coordinates */ /*longmin= */ longmax=-123 /*latmin= */ latmax=56 ; id pruid; run; title1 "British Columbia Coast using the Original Data"; proc sgmap mapdata=BC_projected2 noautolegend; esrimap url="&url/Canvas/World_Light_Gray_Base"; choromap / mapid=pruid; run; quit; ods html close;