New SAS User

Completely new to SAS or trying something new with SAS? Post here for help getting started.
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

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

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
  • 2580 views
  • 4 likes
  • 2 in conversation