Sas Log for this Request
NOTE: running request program dataprog.maptest_08.sas
NOTE: %INCLUDE (level 1) file /public/data/mxplorer/sasprogs/maptest_08.sas is file /public/data/mxplorer/sasprogs/maptest_08.sas.
2 +
3 +%macro mapstate;
4 +*libname aqtag 'F:\aqtag\lqn\aqtag web\data';
5 +*libname lib 'F:\aqtag\lqn\AQProgress\2004\Output';
6 +%global parm stfips endyear;
7 +
8 +%let styear=1990;
9 +%let endyear=2008;
10 +
11 +%if &parm=42101 %then %do; %let poll=Carbon Monoxide; %let stat=MAX2V; %end;
12 +%if &parm=12128 %then %do; %let poll=Lead; %let stat=rqmax; %end;
13 +%if &parm=42602 %then %do; %let poll=Nitrogen Dioxide; %let stat=AMEAN; %end;
14 +%if &parm=44201 %then %do; %let poll=Ozone; %let stat=MAX4V; %end;
15 +%if &parm=81102 %then %do; %let poll=PM10; %let stat=MAX2V; %end;
16 +%if &parm=88101 %then %do; %let poll=PM25; %let stat=WTDAM; %let styear=2000; %end;
17 +%if &parm=42401 %then %do; %let poll=Sulfur Dioxide; %let stat=AMEAN; %end;
18 +
19 +%macro check_session;
20 +
21 + /* Check to see if you are already in a session; if so, you don't need
22 + to validate login info. */
23 + %if %sysfunc(libref(SAVE)) %then %do;
24 + /* SAVE libref doesn't exist, so you have not successfully created session in. */
25 + %let rc=%sysfunc(appsrv_session(create));
26 + %end;
27 +%mend check_session;
28 +
29 +%check_session run;
30 +
31 +
32 +************************ start mapping ***********************************;
33 +
34 +*prep data;
35 +data header;
36 + keep site msa msa_name latitude longitude land_use location county_name address;
37 + set aqtag.masterinfo;
38 + if substr(site,1,2)="&stfips";
39 + call symput('statename',(trim(left(state_name))));
40 +run;
41 +
42 +data prep;
43 + keep site poc x y state land_use location msa county_name msa_name address;
44 + merge aqtag.uninterp&parm&stat&styear&endyear (in=in1) header (in=in2);
45 + by site;
46 + if in1 and in2;
47 + *if trendsite=1; *plot only trend sites;
48 + *if nyrs ge 2; *however many years you want to require;
49 + if latitude eq . or latitude eq 0 or longitude eq . or longitude eq 0 then delete; *otherwise will screw up map;
50 + x=-1*longitude*arcos(-1)/180;
51 + y=latitude*arcos(-1)/180;
52 + t+1;
53 + state=100+t;
54 +run;
55 +
56 +
57 +* server side check to make sure data exists for selection;
58 +* if not, it stops processing and returns a message to the browser;
59 +data _null_;
60 + file _webout;
61 + if numobs=0 then do;
62 + put "<h1>There are no monitoring sites in &statename with adequate data for this trend period.</h1>";
63 + abort;
64 + end;
65 + set prep nobs=numobs;
66 +run;
67 +* server side check end;
68 +
69 +*prep maps;
70 +*have to get PR from the counties map data set;
71 +data stmap;
72 + *length fips $5.;
73 + %if &stfips=72 %then %do;
74 + set maps.counties;
75 + %end;
76 + %else %do;
77 + set maps.county;
78 + %end;
79 + stfips=put(state,z2.);
80 + *fips=put(state,z2.)||put(county,z3.);
81 + if stfips="&stfips";
82 +run;
83 +
84 +*put together;
85 +data main;
86 + set prep stmap;
87 +run;
88 +
89 +proc gproject data=main out=newlocs;* latmax=42 longmin=114 latmin=32.5 longmax=125;
90 + id state;
91 +run;
92 +
93 +data pmmons newstate;
94 + set newlocs;
95 + if state lt 100 then output newstate; else output pmmons;
96 +run;
97 +
98 +/*
99 +proc sort data=pmmons; by county_name site; run;
100 +*/
101 +*------------------DRAW CIRCLES---------------;
102 +DATA ANNO;
103 +SET pmmons;
104 +*by county_name site;
105 +length text $30.;
106 +LENGTH FUNCTION STYLE COLOR $ 8;
107 +XSYS='2';
108 +YSYS='2';
109 +HSYS='1';
110 +/*
111 +if first.county_name then do;
112 +function='label';
113 + text=county_name;
114 + size=2.5;
115 + position='5';
116 +output;
117 +end;
118 +*/
119 +*if first.site then do;
120 +FUNCTION='PIE';
121 +ANGLE=0;
122 +ROTATE=360;
123 +*size=.75;
124 +SIZE=.5;
125 +STYLE='PSOLID';
126 +color='blue';
127 +/*
128 +if location='RURAL' then do;
129 +COLOR='red';
130 +end;
131 +else do;
132 +color='blue';
133 +end;
134 +*/
135 +LINE=1;WIDTH=2; when='A';output;
136 +*end;
137 +run;
138 +
139 +*save session dataset;
140 +data save.anno;
141 +set work.anno;
142 +run;
143 +*create drill down on the point;
144 +data anno;
145 +length drillvar $600;
146 +set anno;
147 +drillvar ='href="'|| "%superq(_THISSESSION)" ||
148 + '&_PROGRAM=dataprog.siteplot_08.sas&_debug=0&site='||site||
149 + '&poll='||&parm||'" target="_blank"';
150 +altvar= 'ALT=" Address='||trim(address) ||' '||'County='||trim(county_name) ||' '||'City='||trim(msa_name) ||' '||'Site Code='||trim(site) ||'"';
151 +html=trim(left(drillvar)) ||' '|| trim(left(altvar));
152 +run;
153 +
154 +*GOPTIONS reset=all CBACK=WHITE DEV=gif;
155 +goptions reset=all /*transparency*/ cells ctext=black htext=1 ftext='swissb' fontres=presentation
156 + cback=white dev=gif /*hpos=100 vpos=40*/ gsfname=_webout xpixels=1000 ypixels=800;
157 +PATTERN1 VALUE=mempty;
158 +%if &parm=88101 %then %do;
159 +title1 "PM2.5 Air Quality Trend Sites in &statename - &styear to &endyear";
160 +%end;
161 +%else %do;
162 +title1 h=1 "&poll Air Quality Monitoring Sites in &statename - &styear to &endyear";
163 +%end;
164 +title2 h=.9 "Mouse over a site to see its location";
165 +title3 h=.9 "Click on a site to see its trend";
166 +title4 h=.75 "Note: This map displays monitoring sites with at least one complete year of data between &styear and &endyear.";
167 +*title4 h=.75 'Note: This map shows only the monitoring sites having adequate data for this trend period.';
168 +*title5 h=.75 'There could be additional sites that are not displayed because they do not have enough data to construct a valid trend during this time period.';
169 +ods listing close;
170 +ods html body=_webout (dynamic)
171 +rs=none
172 +path=&_tmpcat (url=&_replay);
173 +
174 +
175 +*--------------------------MAP IT-----------------------------;
176 +PROC GMAP MAP=newstate DATA=newstate ALL;
177 +ID state county;
178 +CHORO state / cempty=black /*discrete*/
179 + coutline=black NOLEGEND ANNOTATE=ANNO;
180 +run;
181 +quit;
182 + ods html close;
183 + ods listing;
184 +%mend mapstate;
185 +
186 +%mapstate run;
NOTE: There were 17256 observations read from the data set AQTAG.MASTERINFO.
NOTE: The data set WORK.HEADER has 140 observations and 9 variables.
NOTE: DATA statement used (Total process time):
The SAS System
real time 0.29 seconds
cpu time 0.05 seconds
NOTE: There were 176 observations read from the data set AQTAG.UNINTERP12128RQMAX19902008.
NOTE: There were 140 observations read from the data set WORK.HEADER.
NOTE: The data set WORK.PREP has 0 observations and 11 variables.
NOTE: DATA statement used (Total process time):
real time 0.06 seconds
cpu time 0.00 seconds
NOTE: The file _WEBOUT is:
Access Method=Application Server Access Method,
Network connection type=Full Duplex,
Peer IP address=::ffff:134.67.99.205
ERROR: Execution terminated by an ABORT statement at line 186 column 103.
numobs=0 site= poc=. COUNTY_NAME= ADDRESS= LAND_USE= LOCATION= MSA= MSA_NAME= x=. y=. state=. _ERROR_=1 _N_=1
NOTE: 1 record was written to the file _WEBOUT.
The minimum record length was 90.
The maximum record length was 90.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
NOTE: %INCLUDE (level 1) ending.
NOTE: request has completed