Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- libname sasts '/home/klv3840/sasuser.v94';
- * Opgave 1;
- * Opgave 1a;
- * ugevariation;
- PROC TIMESERIES data=sasts.udlaan_6_8 out=chrhavn;
- id date interval=day accumulate=total setmissing=missing;
- var d;
- run;
- * Simpelt plot;
- PROC SGPLOT data=chrhavn;
- series x=date y=d/markers;
- run;
- * Plot over ugedagsvariation;
- data ugevar;
- set chrhavn;
- week=week(date);
- week_day=weekday(date);
- run;
- PROC SGPLOT data=ugevar;
- series x=week_day y=d/group=week markers;
- run;
- * døgnsvariation;
- PROC TIMESERIES data=sasts.udlaan_6_8 out=chrhavn2;
- id date_time interval=hour accumulate=total setmissing=0;
- var d;
- run;
- data dognvar;
- set chrhavn2;
- hour=hour(date_time);
- week=week(date);
- week_day=weekday(date_time);
- run;
- PROC SGPLOT data=dognvar;
- series x=hour y=d/markers;
- run;
- * Opgave 1b;
- PROC TIMESERIES data=sasts.udlaan_6_8 out=chrhavn3;
- id date_time interval=hour6 accumulate=average setmissing=missing;
- var alder;
- run;
- * UCM model med cycles;
- PROC UCM data=chrhavn3 plots=all;
- id date_time interval=hour6;
- model alder;
- level plot=smooth checkbreak;
- slope plot=smooth;
- cycle period=4 rho=1 variance=0 noest=(rho period variance);
- cycle period=28 rho=1 variance=0 noest=(rho period variance);
- outlier ;
- estimate plot=(panel);
- forecast lead=56 plot=forecasts;
- run;
- ods graphics off;
- * UCM model med seasonal dummies;
- ods graphics;
- PROC UCM data=chrhavn3 plots=all;
- id date_time interval=hour6;
- model alder;
- level plot=smooth checkbreak;
- slope plot=smooth;
- season length=4;
- season length=28;
- outlier ;
- estimate plot=(panel);
- forecast lead=56 plot=forecasts;
- run;
- ods graphics off;
- * UCM model med harmonics;
- ods graphics;
- PROC UCM data=chrhavn3 plots=all;
- id date_time interval=hour6;
- model alder;
- level plot=smooth checkbreak;
- slope plot=smooth;
- season length=4 type=trig print=harmonics;
- season length=28 type=trig print=harmonics;
- outlier ;
- estimate plot=(panel);
- forecast lead=56 plot=forecasts;
- run;
- ods graphics off;
- * UCM model med dummy variabel for døgnvariation;
- PROC UCM data=chrhavn3 plots=all;
- id date_time interval=hour6;
- model alder;
- level plot=smooth checkbreak;
- slope var=0 noest;
- season length=4 type=trig print=harmonics;
- outlier ;
- estimate plot=(panel);
- forecast lead=56 plot=forecasts;
- run;
- ods graphics off;
- * UCM model med dummy variabel for ugdagsvariation;
- PROC UCM data=chrhavn3 plots=all;
- id date_time interval=hour6;
- model alder;
- level plot=smooth checkbreak;
- slope var=0 noest;
- season length=28 type=trig print=harmonics;
- outlier ;
- estimate plot=(panel);
- forecast lead=56 plot=forecasts;
- run;
- ods graphics off;
- * Opgave 2;
- * Opgave 2a;
- * Laver mig nyt datasæt;
- data norge1;
- set sasts.udenrigshandel;
- keep date;
- keep s114;
- keep Eksport_i_alt;
- run;
- * Plot data;
- PROC SGPLOT data=norge1;
- series x=date y=s114/markers;
- run;
- * Foretag sæson udrensning;
- PROC X12 data=norge1 date=date;
- var s114;
- x11;
- output out=out_eksport a1 d10 d11 d12 d13 c17; run;
- * Plotter resultatet;
- PROC SGPLOT data=out_eksport;
- series x=date y=s114_A1/markers;
- series x=date y=s114_D11/markers;
- run;
- PROC SGPLOT data=out_eksport;
- series x=date y=s114_D10/markers;
- run;
- PROC SGPLOT data=out_eksport;
- series x=date y=s114_D12/markers;
- run;
- PROC SGPLOT data=out_eksport;
- series x=date y=s114_D13/markers;
- run;
- * Opgave 2b;
- PROC X12 data=norge1 date=date;
- var s114;
- transform function=log;
- automdl;
- regression predefined=(td easter(1));
- outlier;
- forecast lead=36;
- ods output ForecastCL=predicted;
- x11;
- output out=norge2 a1 d10 d11 d12 d13;
- run;
- * Opgave 2c;
- * simple;
- PROC ESM data=norge1 print=estimates
- plot=(MODELFORECASTS ERRORS) lead=36;
- id date interval=month;
- forecast s114/method=simple;
- run;
- * double;
- PROC ESM data=norge1 print=estimates
- plot=(MODELFORECASTS ERRORS) lead=36;
- id date interval=month;
- forecast s114/method=double;
- run;
- * winters;
- PROC ESM data=norge1 print=estimates
- plot=(MODELFORECASTS ERRORS) lead=36;
- id date interval=month;
- forecast s114/method=winthers;
- run;
- * Opgave 2d;
- * varierende trend;
- PROC UCM data=norge1;
- id date interval=month;
- model s114;
- level plot=smooth checkbreak;
- slope plot=smooth ;
- season length=12 plot=(smooth s_annual);
- outlier;
- estimate plot=(panel);
- forecast lead=36 plot=forecasts alpha=0.1;
- run;
- * fast trend;
- PROC UCM data=norge1;
- id date interval=month;
- model s114;
- level plot=smooth checkbreak;
- slope plot=smooth var=0 noest;
- season length=12 plot=(smooth s_annual);
- outlier;
- estimate plot=(panel);
- forecast lead=36 plot=forecasts alpha=0.1;
- run;
- * Opgave 2e;
- * plot de to tidsserier;
- PROC SGPLOT data=norge1;
- series x=date y=s114/markers;
- series x=date y=Eksport_i_alt/markers y2axis;
- run;
- * fast regressionskoefficient;
- PROC UCM data=norge1;
- id date interval=month;
- model s114 = Eksport_i_alt;
- level plot=smooth;
- slope plot=smooth var=0 noest; season length=12 plot=smooth;
- outlier ;
- estimate plot=all;
- forecast lead=36 plot=all alpha=0.1;
- run;
- * varierende regressionskoefficient;
- PROC UCM data=norge1;
- id date interval=month;
- model s114;
- randomreg Eksport_i_alt/plot=smooth;
- level plot=smooth var=0 noest;
- season length=12 plot=smooth;
- outlier;
- estimate plot=all;
- forecast lead=36 plot=all alpha=0.1;
- run;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement