BookmarkSubscribeRSS Feed
lina1583
Fluorite | Level 6

hi all,

 

i'm very new to SAS but have programming experience with java. just wondering if anyone has an example code snippet that reads simple return from a file and compute the acf and pacf for 24 lags? thank you for your help in advance.

 

data will be in this format

 

date                         r

19700130              0.05

19700227              0.06

19700331              -0.03

......

.......

......

 

 

 

5 REPLIES 5
PGStats
Opal | Level 21

The identify statement in proc arima produces acf and pacf estimates. Proc arima is part of SAS/ETS.

PG
lina1583
Fluorite | Level 6

hi, thanks for your reply. what are the statements that I need to write down please? I'm quite new to SAS so i'm not even sure how i should write the identify statements.

 

so if i have the below, what needs to be changed to output acf and pacf?

 

data crsp;

 

infile "\\C\\test.txt"

input date dec1;

 

proc arima data=crsp;

identify var=dec1 nlag=24 stationarity=(adf);

run;

lina1583
Fluorite | Level 6

thanks, i can see the acf and pacf's graph are there but I need a table which has all the numbers for ACF and PACF like below. how do I do it?

 

and how do I run Ljung-box test to test my hypothesis that first 12 lags ACF is 0?

 

lag   acf    pacf

1       0.2     0.2

2       0.1     0.1

3       0.05    0.05

...

 

23

24

PGStats
Opal | Level 21

To get the graph data you will need to use ods output statement:

 

ODS OUTPUT AutoCorrGraph=myACFdata PACFgraph=myPACFdata;

 

You should be getting the Ljung-box statistic in a table out of the identify statement output. Specify whitenoise=ignoremiss if your data contains missing values.

PG

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 1673 views
  • 4 likes
  • 2 in conversation