%let gpath='.';
%let dpi=200;
ods html close;
ods listing image_dpi=&dpi gpath=&gpath;
/*--Generate Wind data--*/
data Wind;
pi=constant("pi");
conv=pi/180.0;
/*--Generate BC data--*/
do r=0 to 25;
do theta=0 to 360 by 2;
x=r*cos(theta*conv);
y=r*sin(theta*conv);
bc=15+10*cos((theta+r*5)*conv) + 5*cos((2*theta+r*5)*conv);
output;
end;
end;
/*--Generate radial axes data--*/
call missing (x, y, bc, r, theta, conv, pi);
x1=0; y1=0; x2= 30; y2= 0; output;
x1=0; y1=0; x2=-30; y2= 0; output;
x1=0; y1=0; x2= 0; y2= 30; output;
x1=0; y1=0; x2= 0; y2=-30; output;
/*--Generate radial axes labels data--*/
call missing (x1, y1, x2, y2);
xl= 32; yl= 0; label='E'; output;
xl=-32; yl= 0; label='W'; output;
xl=0; yl= 32; label='N'; output;
xl=0; yl=-32; label='S'; output;
/*--Generate circular axes data--*/
call missing (xl, yl, label);
do semi=5 to 25 by 5;
xc=0; yc=0; output;
end;
/*--Generate circular axes labels data--*/
call missing (x1, y1, x2, y2);
do semi=5 to 25 by 5;
xcl=semi; ycl=0; labelc=put(semi, 2.0);
output;
end;
run;
/*--Wind XY Graph SG--*/
ods graphics / reset width=3in height=3in imagename='Wind_Graph_XY';
title 'BC Concentration by Wind Speed and Direction';
proc sgplot data=wind aspect=1.0 noborder;
scatter x=theta y=r / colorresponse=bc markerattrs=(symbol=circlefilled size=9)
colormodel=(green yellow red) name='a';
gradlegend 'a' / title='';
xaxis label='Wind Direction' values=(0 to 360 by 15);
yaxis label='Wind Speed';
run;
/*--Wind Polar Graph SG--*/
ods graphics / reset width=4in height=4in imagename='Wind_Graph_Polar_SG';
title 'BC Concentration by Wind Speed and Direction';
proc sgplot data=wind aspect=1.0 noborder;
scatter x=x y=y / colorresponse=bc markerattrs=(symbol=circlefilled)
colormodel=(green yellow red) name='a';
vector x=x2 y=y2 / xorigin=x1 yorigin=y1 arrowheadshape=barbed;
text x=xl y=yl text=label / textattrs=(size=9);
gradlegend 'a' / title='';
xaxis display=none;
yaxis display=none;
run;
/*--Wind Polar Graph GTL--*/
proc template;
define statgraph Wind;
begingraph;
entrytitle 'BC Concentration by Wind Speed and Direction';
layout overlay / xaxisopts=(display=none) yaxisopts=(display=none) aspectratio=1.0
walldisplay=none border=false;
scatterplot x=x y=y / colorresponse=bc markerattrs=(symbol=circlefilled)
colormodel=(green yellow red) name='a';
vectorplot x=x2 y=y2 xorigin=x1 yorigin=y1 / arrowheadshape=barbed;
ellipseparm xorigin=xc yorigin=yc semimajor=semi semiminor=semi slope=0 /
outlineattrs=(color=gray);
textplot x=xl y=yl text=label / textattrs=(weight=bold);
textplot x=xcl y=ycl text=labelc / textattrs=(size=6 weight=bold) position=topright
contributeoffsets=none;
continuouslegend 'a';
endlayout;
endgraph;
end;
run;
/*--Render the Graph--*/
ods graphics / reset antialiasmax=5000 width=4in height=4in imagename='Wind_Graph_Polar_GTL';
proc sgrender data=wind template=Wind;
run;