SAS中文论坛

标题: Annotate ad GMAP [打印本页]

作者: shiyiming    时间: 2011-2-6 22:34
标题: Annotate ad GMAP
Hi,
Sorry, I have no Chinese in this computer and have to use English.  <!-- s:oops: --><img src="{SMILIES_PATH}/icon_redface.gif" alt=":oops:" title="Embarassed" /><!-- s:oops: -->
I tried to label county names in the USCOUNTY map using the codes
below:
**to get the conty name from ZIPCODE file;
proc sql;
create table CNTY_Map as
select t1.county,
      t2.countynm,
      t1.x,
     t1.y
from maps.uscounty t1, SASHELP.Zipcode t2
where t1.state=1 and (t1.state=t2.state and t1.county=t2.county);
run;

*************************
Create Annotate Dataset
*************************;


data cnty_label;
length function style $8 Position $1 text $20;
retain function 'label' xsys ysys '2' when 'a';
set yali.cnty_map(keep=x y countynm);
style='swissb';
text=countynm;
SIZE=0;
POSITION=8;
output;
RUN;


%_sas_pushchartsize(1400, 900);
GOPTIONS CBACK= ;


PATTERN1 VALUE=SOLID COLOR=CX000080;
PATTERN2 VALUE=SOLID COLOR=BLUE;
PATTERN3 VALUE=SOLID COLOR=CX00CCFF;
PATTERN4 VALUE=SOLID COLOR=CYAN;
PATTERN5 VALUE=SOLID COLOR=CXCCFFFF;
PATTERN6 VALUE=SOLID COLOR=WHITE;
PATTERN7 VALUE=SOLID COLOR=CXFFFF99;
PATTERN8 VALUE=SOLID COLOR=CXFFCC99;
PATTERN9 VALUE=SOLID COLOR=CXFFCC00;
PATTERN10 VALUE=SOLID COLOR=MAGENTA;
PATTERN11 VALUE=SOLID COLOR=RED;


***CMPPP is the file contain the response variable;
proc  gmap all data=work.CMPP Map=Cnty_Map;
id countynm;
  choro CMP_PP/ annotate=cnty_label discrete cdefault=white;
run;
quit;


Everything works fine except that the county names got repeated
several times for each county on the map. (I know that in the annotate file the
county names repeated due to the values of x and y. But annotate file
in the example from SAS seems contain more city names). Can sb help me
out. Thanks a lot.
作者: shiyiming    时间: 2011-2-9 09:55
标题: Re: Annotate and GMAP
Actually, it is very simple. The reason for te the repeating of labels for each county is because there are more than one lebels in the annotate dataset for each county.




欢迎光临 SAS中文论坛 (https://mysas.net/forum/) Powered by Discuz! X3.2