/*基于SAS/GRAPH繪制動畫雪景圖*/
/* assign the destination for current directory */
x 'cd d:\docs';
filename out 'test1.gif';
/* set the graphics environment and assign the */
/* appropriategraphics options for the animation */
goptions reset=all device=gifanim gsfname=out
gsfmode=replace iteration=0 delay=80 ftext=swissb
cback=SkyBlue ctext=navy htext=1;
%let n=100;
/* number of patients = number of random numbers */
/* create data sets for the sequence of graphs */
data a;
do i=1 to &n;
x=3+rannor(345);
y=pdf('PARETO',x,.5,1);
output;
end;
run;
data b; set a;
do k=1 to &n+1-i;
l=&n+1-k;
output;
end;
run;
proc sort data=b; by l; run;
data c; set b; by l;
z=0; w=1; output;
z=0; w=2; output;
z=0; w=3; output;
run;
proc sort data=c; by l w; run;
data d; set c;
if i=l and w=1 then z=y*2;
if i=l and w=2 then z=y;
run;
data test;
do x=0 to 7 by .1;
z1=pdf('PARETO',x,.5,1);
output;
end;
run;
data test1; set test;
do l=1 to &n;
do w=1 to 3;
output;
end;
end;
run;
data plot; set test1 d; run;
proc sort data=plot; by l w; run;
/*The following code sets the symbol statements for the graphs and uses */
/*proc gplot to produce the plots to be animated by GIFANIM driver */
symbol1 color=green i=join w=5 l=45;
symbol2 font=marker value=T color=Snow h=3;
axis1 order=(0 to .5 by .1) offset=(1,1) minor=(number=1) label=none ;
axis2 order=(0 to 7 by 1) offset=(1,1) minor=(number=1) label=none ;
/*VALUE=special-symbol specifies a plot symbol for the data points */
proc gplot data=plot uniform;
plot z1*x=1 z*x=2/vaxis=axis1 haxis=axis2 overlay CFRAME=SkyBlue
vref=.1 to .4 by .1 lvref=2
href= 1 to 6 by 1 lhref=2 nolegend ;
by l w;
run; quit;
/* end the animation */
data _null_;
file out recfm=n mod; put '3B'x;
run;
/*disassociates the currently assigned filerefs*/
filename out clear;
/* 瑞雪兆豐年 */
/* 看官,請點擊帖子左下角的“評分”給點鼓勵吧! */