问题:我需要使用SAS生成一个180天数据的图表,问题是180天由于天数太多造成横坐标很拥挤,导致日期太密麻,不方便观看,因此我想变成每隔一天显示日期,如,20Aug2015,22Aug2015,24Aug2015........,但是图表中的数据是每天都要显示,excel很容易实现,但SAS遇到这个问题。
代码如下:分两部分,大家看红色部分就可以了,第一部分是我生成日期,第二部分是画图:
Data _Null_;
Call Symput('sDate',put((today()-179)*86400,datetime13.));
Call Symput('eDate',put((today()+1)*86400,Datetime13.));
Call Symput('mUnit',put(DatDif(today()-179,today()+1,'act/act')/2,10.2));
Run;
/*ods listing close;*/
/*ods html path="C:\query run data\2015\Aug\0828"*/
/* body="p1_spc_test.html" */
/* gpath="&rpath\image"(url='image\')*/
/* style=listing*/
/* newfile=proc;*/
ods html style=listing path="C:\query run data\2015\Aug\0827" (url=none)
body="P1 yld chart.HTML" (title="TREND");
goptions RESET=ALL vsize=15cm hsize=30cm device=gif graphrc interpol=join gsfmode=replace;
/*goptions reset=all device=gif graphrc interpol=join gsfmode=replace;*/
symbol1 c=DEFAULT w=1.3 i=join ci=magenta v=dot cv=green h=0.6 ;
symbol2 c=DEFAULT i=none v=dot cv=yellow h=0.6; %** GLD CL dot **;
symbol3 c=DEFAULT i=none v=dot cv=red h=0.6; %** GLD CL dot **;
symbol4 c=DEFAULT i=join v=none l=20 ci=blue ;%** Action dot**;
symbol5 c=DEFAULT i=join v=none l=20 ci=red ;%** GLD WL dot**;
symbol6 c=DEFAULT i=join v=none l=20 ci=red ; %** GLD CL dot **;
axis1 color=black offset=(1.0,0) value=(f=arial h=0.5 a=270) label=(c=black f="Arial" h=1.0 'Sputter Date') width=1.8
order="&sDate"dt to "&eDate"dt by "&mUnit"D;
axis2 color=blue offset=(1.0,1.0) label=(c=blue a=90 f=arial h=1.1 "Yield") value=(f=arial h=1.0) width=1.8
order=(0 to 80 by 10 80 to 100 by 2) minor=none;
axis3 color=blue offset=(1.0,1.0) label=(c=blue a=90 f=arial h=1.1 "Quantity(SS>=1000pcs)") value=(f=arial h=1.0) width=1.8 minor=none;
legend1;
legend2 label=none
value =(t=1 'P1 Yield' t=2 "Yellow" t=3 "Red" t=4 "LWL" t=5 "LCL" t=6 "+++" );
title1 c=blue h=1.3 " P1 Yiled Summary" ;
footnote j=r f=times c=black h=.9 "updated &SYSDATE9. &SYSTIME.";
pattern1 v=e;
proc gbarline data=data;
format date date5.;
by family_name;
bar date /sumvar= glddisks
discrete raxis=axis3 maxis=axis1 ;
plot / sumvar= yld raxis=axis2 legend=legend2;
plot / sumvar= sig3 raxis=axis2 ;
plot / sumvar= sig4 raxis=axis2 ;
plot / sumvar= lwl raxis=axis2 ;
plot / sumvar= lcl raxis=axis2 ;
run;
quit;
ods html close;
生成的图片