拟合AR模型的代码

摘自《SAS FOR FORECASTING TIME SERIES》

 

 

DATA SILVER;
TITLE 'MONTH END STOCKS OF SILVER';
INPUT SILVER @@;
T=_N_;
RETAIN DATE '01DEC76'D LSILVER1-LSILVER4;
DATE=INTNX('MONTH',DATE,1);
FORMAT DATE MONYY.;
OUTPUT;
LSILVER4=LSILVER3;
LSILVER3=LSILVER2;
LSILVER2=LSILVER1;
LSILVER1=SILVER;
CARDS;
846 827 799 768 719 652 580 546 500 493 530 548 565
572 632 645 674 693 706 661 648 604 647 684 700 723
741 734 708 728 737 729 678 651 627 582 521 519 496
501 555 541 485 476 515 606 694 788 761 794 836 846
;
RUN;
PROC PRINT DATA=SILVER;
RUN;
PROC REG DATA=SILVER;
MODEL SILVER=LSILVER1 LSILVER2
LSILVER3 LSILVER4 / SS1;
RUN;
PROC REG DATA=SILVER;
MODEL SILVER=LSILVER1 LSILVER2;
RUN;

你可能感兴趣的:(Date,input)