1 / 28

如何使用 sas map 繪製地圖

如何使用 sas map 繪製地圖. 以台灣地圖為例. 想一想如何作畫. 材料 1. 一張台灣地圖 2. 一份各地區觀測值資料 工具 GMAP procedure 表示方式 --- 平面圖 或 長方圖. Sas map data sets. default sas library : Maps Taiwan Taiwan2. 縣市為最小單位. Taiwan : Map data-set. 座標. 才能畫界線. Taiwan2 : Response data set. 以鄉鎮為最小單位. GMAP procedure.

zea
Download Presentation

如何使用 sas map 繪製地圖

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 如何使用sas map 繪製地圖 以台灣地圖為例

  2. 想一想如何作畫 • 材料 1.一張台灣地圖 2.一份各地區觀測值資料 • 工具 GMAP procedure • 表示方式---平面圖 或 長方圖

  3. Sas map data sets • default sas library : Maps • Taiwan • Taiwan2 縣市為最小單位

  4. Taiwan : Map data-set 座標 才能畫界線 Taiwan2 : Response data set 以鄉鎮為最小單位

  5. GMAP procedure • Use the PROC GMAP statement to identify the map and response data sets. • Use the ID statement to name the identification variable(s). • Use a BLOCK, CHORO, PRISM, or SURFACE statement to identify the response variable and generate the map

  6. Procedure Syntax • PROC GMAPMAP=map-data-set<DATA=response-data-set> <ALL> <ANNOTATE=Annotate-data-set> <GOUT=<libref.>output-catalog> <IMAGEMAP=output-data-set> ID id-variable(s); CHOROresponse-variable(s) </ option(s)>;BLOCKresponse-variable(s) </ option(s)>; PRISMresponse-variable(s)</ option(s)>; SURFACEresponse-variable(s) </ option(s)>;

  7. Producing a Simple Surface Map

  8. Basic procedure Simple and Easy

  9. choro • Creates two-dimensional maps in which values of the specified response variables are represented by varying patterns and colors. procgmap data=maps.taiwan2 map=maps.taiwan id id; choro idname/discrete coutline=black ; run; Response data set Map data-set Response var.?

  10. block • Creates three-dimensional block maps on which levels of magnitude of the specified response variables are represented by blocks of varying height, pattern, and color. data map; set maps.taiwan2; if id in (5101520) then no=5; else if id in ( 369121518 ) then no=3; else if id in (71421) then no=7; else no=0; run; procgmap data=map map=maps.taiwan id id; block no/discrete coutline=black CBLKOUT=black ; run;

  11. prism • Creates three-dimensional prism maps in which levels of magnitude of the specified response variables are represented by polyhedrons (raised polygons) of varying height, pattern, and color. procgmap data=map map=maps.taiwa id id; prism no/discrete coutline=black; run;

  12. Advance procedure ---to enhance the map Complicated and Optional

  13. By var legend Annotate pattern

  14. example goptions reset=all; legend1 position=( middle right inside) label=none shape=bar(1,1)pct mode=share across=1; Data citystar; ……;run; procgmap data=strata8 map=d.taiwan; by strata; id id; choro city1 city /discrete coutline=black legend=legend1 annotate=citystar; format city1 city city. strata st.; run;

  15. Method • Goptions --- Set the graphics environment • Pattern • Legend • Annotate data set • Choro statement </options> -- appearance options -- legend options -- mapping options

  16. Goptions --- set the graphics environment • options that affect the appearance of the display area and the graphics output • options that affect color • options that control font selection or text appearance goptions reset=global gunit=pct border cback=white colors=(black blue green red) ctext=black ftext=swiss htitle=6 htext=3;

  17. pattern pattern1 v=ms c=LIB; pattern2 v=ms c=LIBG; V=map/plot-pattern

  18. Plot pattern

  19. legend The LEGEND statement controls the location and appearance of legends on two-dimensional plots, contour plots, maps, and charts. legend1 position=( middle right inside) label=none shape=bar(1,1)pct mode=share across=1;

  20. Annotate data set data citystar; length function style color $ 8 position $ 1 text $ 20; retain function 'label' xsys ysys '2' hsys '3' when 'a'; set xy(keep=id idname x y); if id in (305 110 111 1201 6307 1015 401 1327 1203 1214 151010031702619); /*city 為縣市代碼*/ if id>999 then city=substr(id,9,2)*1; else if id>99 then city=substr(id,10,1)*1; else city=substr(id,11,2)*1; if id^=0; /*strata 分層*/ if (id in ( 63101102103104105106110111))or (city in(63))then strata=1; if (id in (107108109112113114115116117118119 12012112212312412512612712812917)) or (city in (17))then strata=2; if (city in (34518)) then strata=3; if (city in (67819)) then strata=4; if (city in (920102111)) then strata=5; if (city in (64121316)) then strata=6; if (city in (21415)) then strata=7; style='special'; text='M'; color='red'; size=7; position='5'; output; style='KAI'; text=idname; color='yellow';size=5; position='8'; output; run;

  21. Choro statement </options>; procgmap data=strata8 map=d.taiwan; by strata; id id; choro city1/discrete coutline=black legend=legend1 annotate=citystar; format city1 city. strata st.; run;

  22. appearance options ANNOTATE=Annotate-data-set CEMPTY=empty-area-outline-color COUTLINE=nonempty-area-outline-color | SAME XSIZE=map-width <units> YSIZE=map-height <units

  23. legend options CTEXT=text-color LEGEND=LEGEND<1...99> NOLEGEND

  24. mapping options DISCRETE LEVELS=number-of-response-levels MIDPOINTS=value-list MISSING

  25. 找個例子試試看囉 The End

More Related