BookmarkSubscribeRSS Feed
Fluorite | Level 6

Hi SAS experts,


I'm trying to do an interrupted time series (ITS) analysis to compare before and after certain intervention.



From the reference, here are the steps I went through so far.


1.I prepared the dataset with variables  (1) outcome (2) t_before [serial count 1,2,3...] (3) intervention [0 or 1] (4) t_after [0,0,0,...intervention... , 1, 2, 3...]



2. Then I used PROC ARIMA identify to check for the stationarity as follows:

proc arima data=sample;
identify var=outcome stationarity=(adf);

since the result showed that 'outcome' is nonstationary, I used first-order difference as follows and the test showed stationary:

proc arima data=sample;
identify var=outcome(1) stationarity=(adf);


3. and from the ACF, PACF plots from above, I thought AR(5) model would fit, so I tried final diagnosis as: 

proc arima data=sample;
identify var=outcome(1) ;

estimate p=5;

and the result seemed reasonable.



So, here is my question.

0. the ITS equation I want to use is :  outcome  =   t_before(b1 -> previous trend)  intervention(b2 -> level change)  t_after(b3 -> trend change) , under  ARIMA (5, 1, 0) model


1. if so, how can I put this equation into PROC ARIMA to get the coefficients of b1, b2, and b3?

some references seem to use PROC MODEL, or PROC AUTOREG, but I don't think those cases consider the ARIMA  (because those programs have no coded lines such as 'p=~~', 'q=~~' or checking ACF, PACF and so on)


2. if I also want to estimate the slope of post trend, which is (b1+b3), how should I code to get the estimation and the p-value for (b1+b3)



I attached the sample dataset.

Thanks for your help in advance

SAS Employee


proc arima data=sample;
identify var=outcome(1) crosscorr=intervention noprint;
estimate p=1 input=intervention method=ml;



1.  I have reduced your p=5 to p=1 because the higher order coefficients are not very significant.  The residual plots appear OK.

2.  The pre-intervention slope (MU in this case) is estimated as -0.72433, which seems reasonable since the outcome is trending downward prior to intervention.

3.  Post-intervention slope, MU + intervention coefficient, turns out to be (-0.72433 + 12.49581).


Hope this works for you.


By the way, for carrying out more general types of analyses described in the paper you mention it is easier to use PROC SSM.  This is a newer procedure than ARIMA and provides much broader support for time series modeling and intervention analysis.  The learning curve for PROC SSM is a bit steep but I think worth taking a look.  See 

Selukar, R. S. (2017). “Detecting and Adjusting Structural Breaks in Time Series and Panel Data Using the SSM Procedure.” In Proceedings of the SAS Global Forum 2017 Conference. Cary, NC: SAS Institute Inc.



Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 1 like
  • 2 in conversation