Hi guys, I'm new to this program and I don't know how to code in this program. I'm and Accounting Student and I want to use SAS to working on my bachelor thesis. Is there anymistake in these code or something? Pls help, I really don't know what to do 😞 Here attached my code for my project, can anyone help me please? data arton;
infile datalines eof=last;
input MidSya;
date=_n_-1;
output;
return;
last: do i=1 to 30;
MidSya=.;
date+1;
output;
end;
return;
datalines;
3.150
3.153
3.157
3.158
3.160
3.161
3.163
3.167
3.168
3.171
3.174
3.175
3.175
3.177
3.178
3.180
3.181
3.182
3.180
3.179
3.178
3.179
3.180
3.181
3.182
3.182
3.183
3.185
3.186
3.186
3.188
3.189
3.187
3.187
3.188
3.189
3.189
3.190
3.191
3.186
3.186
3.186
3.188
3.189
3.189
3.189
3.189
3.191
3.189
3.190
3.193
3.194
3.196
3.198
3.200
3.201
3.203
3.203
3.204
3.205
3.206
3.206
3.208
3.210
3.209
3.210
3.208
3.206
3.209
3.212
3.213
3.213
3.214
3.213
3.214
3.217
3.218
3.218
3.218
3.219
3.218
3.220
3.218
3.218
3.217
3.213
3.216
3.218
3.219
3.222
3.221
3.222
3.226
3.226
3.226
3.227
3.227
3.226
3.228
3.231
3.230
3.231
3.232
3.233
3.231
3.234
3.238
3.237
3.237
3.238
3.237
3.236
3.235
3.242
3.241
3.242
3.233
3.235
3.235
3.237
3.242
3.245
3.241
3.244
3.246
3.248
3.255
3.260
3.260
3.262
3.261
3.262
3.260
3.259
3.254
3.253
3.255
3.257
3.260
3.262
3.262
3.264
3.265
3.267
3.271
3.267
3.269
3.269
3.270
3.272
3.275
3.277
3.283
3.302
3.305
3.313
3.318
3.321
3.329
3.334
3.343
3.358
3.344
3.339
3.338
3.335
3.337
3.338
3.341
3.343
3.354
3.362
3.362
3.355
3.360
3.354
3.353
3.353
3.354
3.353
3.353
3.350
3.348
3.348
3.352
3.353
3.353
3.351
3.349
3.350
3.345
3.347
3.342
3.339
3.338
3.338
3.340
3.346
3.349
3.356
3.356
3.358
3.360
3.358
3.358
3.361
3.359
3.360
3.360
3.363
3.365
3.365
3.366
3.366
3.367
3.371
3.370
3.372
3.375
3.377
3.379
3.382
3.380
3.377
3.376
3.375
3.376
3.375
3.374
3.375
3.374
3.373
3.374
3.372
3.374
3.370
3.369
3.369
3.369
3.376
3.377
3.377
3.381
3.384
3.375
3.376
3.380
3.381
3.382
3.383
3.382
3.382
3.382
3.380
3.381
3.383
3.383
3.378
3.373
3.375
3.378
3.378
3.377
3.375
3.376
3.375
3.375
3.374
3.376
3.375
3.373
3.372
3.371
3.370
3.365
3.361
3.362
3.362
3.360
3.357
3.358
3.360
3.360
3.358
3.357
3.354
3.356
3.361
3.364
3.364
3.363
3.365
3.364
3.365
3.366
3.365
3.367
3.369
3.370
3.374
3.376
3.375
3.375
3.376
3.376
3.378
3.378
3.380
3.378
3.378
3.378
3.377
3.377
3.378
3.375
3.375
3.370
3.363
3.355
3.360
3.363
3.361
3.358
3.361
3.359
3.349
3.346
3.344
3.352
3.353
3.350
3.349
3.346
3.345
3.343
3.343
3.341
3.344
3.355
3.356
3.353
3.366
3.364
3.361
3.356
3.355
3.361
3.355
3.348
3.352
3.350
3.350
3.332
3.327
3.334
3.335
3.330
3.304
3.280
3.277
3.268
3.266
3.265
3.265
3.262
3.255
3.252
3.245
3.240
3.238
3.233
3.230
3.224
3.223
3.224
3.222
3.226
3.327
3.327
3.334
3.340
3.344
3.338
3.341
3.329
3.327
3.323
3.326
3.330
3.330
3.328
3.329
3.328
3.327
3.328
3.323
3.318
3.314
3.305
3.294
3.289
3.287
3.290
3.292
3.292
3.295
3.295
3.296
3.301
3.302
3.305
3.306
3.306
3.308
3.310
3.312
3.318
3.315
3.315
3.311
3.307
3.304
3.303
3.302
3.301
3.296
3.297
3.294
3.301
3.301
3.298
3.301
3.304
3.307
3.306
3.305
3.307
3.306
3.308
3.312
3.322
3.326
3.328
3.331
3.337
3.336
3.334
3.333
3.335
3.368
3.365
3.391
3.378
3.377
3.378
3.379
3.380
3.380
3.379
3.380
3.385
3.383
3.381
3.378
3.379
3.377
3.373
3.374
3.378
3.378
3.379
3.382
3.382
3.385
3.388
3.390
3.390
3.390
;
/*data arton;*/
/*set arton;*/
/*date = _n_-1;*/
/*run;*/
proc gplot data=arton;
plot MidSya*date/ vref=0;
symbol i=join v=none;
run;
proc autoreg
data = arton;
model MidSya=/stationarity=(adf=3);
run;
proc arima data=arton;
identify var=MidSya nlag=24;
run;
proc arima data=arton;
identify var=MidSya (2);
estimate p=2 q=1;
forecast lead=12 interval=day id=date out=results;
run;
/* TESTING FOR ARCH EFFECT */
proc autoreg data=MidSya;
model MidSya=date / nlag=2 archtest dwprob;
output out=r r=MidSyaresid;
run;
Proc autoreg data=arton maxit=200;
model MidSya=/ noint garch=(q=15);
output out=out0 cev=vv;
run;
/*AR(1)-GARCH(1,1) Model */
proc autoreg data=arton;
model MidSya= / nlag=1 garch= (p=1, q=1) maxit=200;
output out=out1 cev=vhat1 p=p_garch1 ucl=u1 lcl=l1
r=r_garch1 cpev=cpev1;
run;
data out1a;
set out1;
length type $ 8.;
if MidSya^=. then do;
type = 'ESTIMATE'; output; end;
else do;
type= 'FORECAST'; output; end;
run;
proc sgplot data=out1a;
series x=date y=vhat1 /group=type;
refline 641/ axis= x LINEATTRS= (pattern=ShortDash);
run;
/*AR(1)-GARCH(1,1) Model */
proc autoreg data=arton;
model MidSya= / nlag=1 garch= (p=1, q=1) maxit=200;
output out=out2 cev=vhat2 p=p_garch2 ucl=u2 lcl=l2
r=r_garch2 cpev=cpev2;
run;
/*Estimate upper and lower forecast*/
data outp11;
set out1;
u_garch=p_garch1+2*sqrt(cpev);
l_garch=p_garch1-2*sqrt(cpev);
run;
/*print forecast AR(2)-GARCH(1,1) */
proc print data=outp11;
where date> 1;
var date u1 u_garch p_garch1 MidSya l_garch l1 r_garch1;
run;
proc gplot data=outp11;
where date > 1;
plot u1*date=1 p_garch1*date=2 MidSya*date=3 l1*date=4/overlay;
run;
/*Estimate upper and lower forecast*/
data outp22;
set out2;
u_garch=p_garch2+2*sqrt(cpev2);
l_garch=p_garch2-2*sqrt(cpev2);
run;
/*print forecast AR(2)-GARCH(1,1) */
proc print data=outp22;
where date> 1;
var date u2 u_garch p_garch2 MidSya l_garch l2 r_garch2;
run;
proc gplot data=outp22;
where date > 1;
plot u2*date=1 p_garch2*date=2 MidSya*date=3 l2*date=4/overlay;
run;
... View more