ods html close;
%let gpath='C:\';
%let dpi=100;
ods listing style=htmlblue gpath = &gpath image_dpi=&dpi;
proc sort data=sashelp.stocks out=stocksort;
by date;
run;
data stocks;
retain prev;
set stocksort(where=(date > '01Jan02'd));
year=year(date);
ymin=10;
if year eq prev then year=.;
else prev=year;
run;
/*proc print; run;*/
ods listing;
ods graphics / reset width=5in height=3in imagename='Time_Axis_Basic';
proc sgplot data=stocks;
title 'Monthly Closing Prices by Stock';
series x=date y=close / group=stock lineattrs=(thickness=3);
xaxis display=(nolabel);
yaxis grid label='Close';
run;
ods graphics / reset width=5in height=3in imagename='Time_Axis_Inside_Year';
proc sgplot data=stocks;
title 'Monthly Closing Prices by Stock';
series x=date y=close / group=stock lineattrs=(thickness=3);
scatter x=date y=ymin / markerchar=year markercharattrs=(size=9);
xaxis display=(nolabel) tickvalueformat=monname3.;
yaxis grid label='Close';
run;
ods graphics / reset width=5in height=3in imagename='Time_Axis_Qtr';
proc sgplot data=stocks noborder;
title 'Monthly Closing Prices by Stock';
series x=date y=close / group=stock lineattrs=(thickness=3);
scatter x=date y=ymin / markerchar=year markercharattrs=(size=9);
xaxis display=(nolabel) tickvalueformat=qtr. interval=quarter;
yaxis grid label='Close';
run;
/*--SAS 9.4 --*/
ods graphics / reset width=5in height=3in imagename='Time_Axis_Qtr_94';
proc sgplot data=stocks noborder;
title 'Monthly Closing Prices by Stock';
series x=date y=close / group=stock lineattrs=(thickness=3)
curvelabel curvelabelpos=start;
scatter x=date y=ymin / markerchar=year markercharattrs=(size=9);
xaxis display=(nolabel) tickvalueformat=qtr. interval=quarter;
yaxis display=(noline) grid label=' $' labelpos=top;
run;