Time Series Analysis Package

CCF Method

  • rc = TSA.CCF (y, x, nlag, <lags>, <df>, <ymu> , <xmu>, <ccov>, <ccf>, <ccfstd>, <ccf2std>, <ccfnorm>, <ccfprob>, <ccflprob>, <adjscale>);

The CCF function computes the cross-correlation and cross-covariance for two time series arrays.

Required Arguments

You must specify the following arguments, separated by commas:

y

specifies one times series array.

x

specifies the other time series array.

nlag

specifies the number of the lag to compute.

Optional Arguments

You can also specify the following arguments, separated by commas. If you want to use a default value for any of these arguments, enter a space for it.

adjscale

specifies adjscale, which controls the normalization of the cross-covariance and cross-correlation. You can specify the following numeric values:

0

specifies the default normalization.

1

specifies the unbiased normalization.

2

specifies the biased normalization.

For more information, see Table 6.

Returned Values

The CCF function returns the following values:

rc

returns one of the following scalar return codes:

rc Termination Reason
0 Success
< 0 Computational failure

Optional Returned Values

You can also specify the following arguments, separated by commas, to request additional returned values. If you do not want the value to be returned, enter a space for it.

lags

returns an array of lags that were computed, with sans-serif-italic nlag plus 1 entries.

df

returns an array of number of products for which to compute the cross-correlation, with sans-serif-italic nlag plus 1 entries.

ymu

returns the mean estimate of input time series y.

xmu

returns the mean estimate of input time series x.

ccov

returns an array of cross-covariance estimates, with 2 times sans-serif-italic nlag plus 1 entries.

ccf

returns an array of cross-correlation estimates, with 2 times sans-serif-italic nlag plus 1 entries.

ccfstd

returns an array of standard errors, with 2 times sans-serif-italic nlag plus 1 entries.

ccf2std

returns an array of double standard errors, with 2 times sans-serif-italic nlag plus 1 entries.

ccfnorm

returns an array of normalized cross-correlation, with 2 times sans-serif-italic nlag plus 1 entries.

ccfprob

returns an array of probabilities, with 2 times sans-serif-italic nlag plus 1 entries.

ccflprob

returns an array of log probabilities, with 2 times sans-serif-italic nlag plus 1 entries.

Example

This example uses the TSMODEL procedure to compute the cross-correlation and cross-covariance of two time series arrays (Price and Sale) with lag 20:

data mylib.pricedata (replace=yes);
   set Sashelp.pricedata;
run;
proc tsmodel data=mylib.pricedata outarray=mylib.ccf_array
              outscalar=mylib.ccf_scalar;
   id date interval=month;
   var price sale;
   by region line product;
   outscalars ymu xmu;
   outarrays lags df ccov ccf ccfstd ccf2std ccfnorm ccfprob ccflprob;
   require tsa;
   submit;
   declare object TSA(tsa);
   rc=TSA.CCF(price, sale, 20, lags, df, ymu, xmu, ccov, ccf,
              ccfstd, ccf2std, ccfnorm, ccfprob, ccflprob);
   endsubmit;
run;
Last updated: July 09, 2026