再试试看。我的机子上运行没问提。这里是log 文件
1 data a1;
2 input t year xt;
3 yt+xt;
4 index=1; zt=-(yt+lag(yt))/2;
5 datalines;
NOTE: Missing values were generated as a result of performing an operation on missing values.
Each place is given by: (Number of times) at (Line):(Column).
1 at 4:17
NOTE: The data set WORK.A1 has 12 observations and 6 variables.
NOTE: DATA statement used (Total process time):
real time 0.64 seconds
cpu time 0.03 seconds
18 ;
19 proc print data=a1; run;
NOTE: There were 12 observations read from the data set WORK.A1.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.29 seconds
cpu time 0.00 seconds
20 PROC IML;
NOTE: IML Ready
21 USE a1;
21 !
22 READ ALL VAR{zt index} INTO B WHERE(zt^=.);
22 !
23 READ ALL VAR{xt} INTO Yn WHERE(zt^=.);
23 !
24 ahat = INV(B`* B)* B`*Yn;
24 !
25 ahatt = ahat`;
25 ! na = {a u};
25 !
26 CREATE a2 FROM ahatt[COLNAME=na];
26 !
27 APPEND FROM ahatt;
27 !
28 QUIT;
NOTE: Exiting IML.
NOTE: The data set WORK.A2 has 1 observations and 2 variables.
NOTE: PROCEDURE IML used (Total process time):
real time 0.29 seconds
cpu time 0.03 seconds
29 proc print data=a2; run;
NOTE: There were 1 observations read from the data set WORK.A2.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
30 DATA a3;
31 SET a2;index = 1;
NOTE: There were 1 observations read from the data set WORK.A2.
NOTE: The data set WORK.A3 has 1 observations and 3 variables.
NOTE: DATA statement used (Total process time):
real time 6.21 seconds
cpu time 0.12 seconds
32 DATA a4;
33 SET a1; IF _N_ = 1;xt0 = xt ;
34 KEEP xt0 index;
NOTE: There were 12 observations read from the data set WORK.A1.
NOTE: The data set WORK.A4 has 1 observations and 2 variables.
NOTE: DATA statement used (Total process time):
real time 21.15 seconds
cpu time 0.53 seconds
35 DATA a5;
36 MERGE a1 a3 a4; BY index;
37 IF _N_ = 1 THEN xp = xt;
38 ELSE DO;
39 yt1=(xt0-u/a)*EXP(-a*(t-1))+u/a;
40 yt0=(xt0-u/a)*EXP(-a*(t-2))+u/a;
40 ! */
41 xp=yt1-yt0;
42 END;
43 error = xp - xt;
44 rerror = error/xt*100;
45 DROP yt index zt yt1 yt0 xt0;
NOTE: There were 12 observations read from the data set WORK.A1.
NOTE: There were 1 observations read from the data set WORK.A3.
NOTE: There were 1 observations read from the data set WORK.A4.
NOTE: The data set WORK.A5 has 12 observations and 8 variables.
NOTE: DATA statement used (Total process time):
real time 5.18 seconds
cpu time 0.17 seconds
46 PROC PRINT DATA = a5;
47 RUN;
NOTE: There were 12 observations read from the data set WORK.A5.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
46 PROC PRINT DATA = a5;
47 RUN;
NOTE: There were 12 observations read from the data set WORK.A5.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds