BookmarkSubscribeRSS Feed

User-friendly SAS application for performing seasonal Kendall’s Trend Analysis (Hirsch et al., 1982)

Started ‎08-02-2021 by
Modified ‎08-02-2021 by
Views 4,241

The seasonal Kendall test (Hirsch et al., 1982) accounts for seasonality by computing the Mann-Kendall test on each of m seasons separately, and then combining the results. Overall Tau is a weighted average of twelve rank-correlation coefficients, one for each month of the year. The P-value accompanying each Tau value is the result of a test of significance for each month. The test of significance of overall Tau is the test for trend. The Overall Tau is much more sensitive than the monthly tests for the simple reason that the overall test is based on a much larger sample (approximately 12 times larger). Thus, it is possible to have an Overall Tau that is significantly different from zero while none of the monthly Tau’s upon which it is based is significant.


Slope: The rate of change of each water-quality is quantified by the seasonal Kendall slope estimator (Hirsch, et al.,1982). It has the same robust statistical properties as Tau. Moreover, the test of significance of Tau can also be interpreted as a test of significance of the hypothesis that the median change per year (slope) is different from zero. The Overall Seasonal Kendall Estimate, along with 90% and 95% confidence limits of the change per year, is tabulated. There are 3 kinds of estimates: (1) change per year (slope), (2) percent change per year (percentage of the median) and (3) relative change per year (%).


Kendall SAS macro: A user-friendly SAS macro application Kendall, using Microsoft Windowing Environment to perform seasonal trend analysis using seasonal Kendall trend model was published by Tian and Fernandez (1998). However, this originally published macro application is not compatible with SAS Enterprise Guide or SAS studio environment. Therefore, an enhanced user-friendly SAS macro application that is compatible in SAS Display manager, SAS Enterprise Guide, and SAS Studio is developed and presented here.


Kendall User-friendly SAS macro application:

First download and unzip the specified in this post.  SAS version 9.4 for was used to develop this SAS MACRO programs and the relevant MACRO-CALL file for seasonal Kendall’s Trend analysis. The requirements for using this SAS macro are

(1) A valid license to run the SAS software on your PC, and

(2) SAS modules such as SAS/BASE, SAS/IML and SAS/STAT should be licensed to get complete results.

The steps for performing the user-friendly SAS macros are:


Step1: Input the permanent SAS data file like the example data file included with the zip file. This data should contain the following variables:

  • Interval Response variable(s) (RESP)
  • Date variable (Date).
  • Optional seasonal variable, MM (month, week).
  • Required Year variable

 Step 2: Submit the SAS macro call file after filling the appropriate macro input

After inputting all required fields (Figure 1), Run the macro-call file. The MACRO-CALL file automatically accesses the SAS Kendall macro from the specified location. After a successful run, this macro will generate following exploratory graphs, Kendall univariate statistics, Kendall overall tau, Kendall seasonal tau and Kendall seasonal slope and confidence intervals.




Figure 1 Screenshot of Kendall macro-call with acceptable macro inputs.








HirschR.M, Slack J.Rand Smith R.A (1982) Techniques of trend analysis for monthly water quality data Water Resources Research 18:107-121.

Tian J and Fernandez G.C.J (1998) Seasonal Trend Analysis of Monthly Water Quality Data 

Western SAS User Conference proceeding paper.



Version history
Last update:
‎08-02-2021 02:27 AM
Updated by:



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!

Free course: Data Literacy Essentials

Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning  and boost your career prospects.

Get Started

Article Tags