The following code (1) downloads McDonald's stock prices from July 5, 1966 to November 1, 2021, (2) computes its percent returns, and (3) estimates the GARCH(1,1) model.
filename mcd url 'https://query1.finance.yahoo.com/v7/finance/download/
mcd?period1=-999999999&period2=9999999999';
proc import file=mcd dbms=csv replace out=mcd;
run;
proc expand out=mcd;
id date;
convert adj_close=return/tout=(pctdif);
run;
proc autoreg;
model return=/garch=(q=1,p=1);
output ht=variance out=mcd;
run;
Because ARCH1+GARCH1=0.0485+0.9539=1.0024>1, the unconditional variance is undefined. However, the output data set assigns 3.8592488163 as the variance of the first observation—how does AUTOREG compute this value of 3.8592488163 here? It seems this is not documented in The AUTOREG Procedure.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.