This macro calculates the Pain Index, defined as the average of 'drawdowns' (cumulative losses) over the analysis period. It differs from the Ulcer Index because drawdowns are not squared, and from the average drawdown because the denominator is the total number of observations. It depends on the external macros %get_number_column_names, %ranname, and %drawdowns.
Data Analysis
Type : EXTERNAL
Data is provided via the 'returns' macro parameter. Processing also depends on external utility macros.
1 Code Block
MACRO DEFINITION
Explanation : Macro definition, declaration of local variables, and initialization of temporary table names via %ranname. Retrieval of numeric columns via %get_number_column_names.
Copied!
%macro pain_index(returns,
method= DISCRETE,
dateColumn= DATE,
outData= painindex);
%local vars drawdown stat_mean i;
%let vars= %get_number_column_names(_table= &returns, _exclude= &dateColumn);
%put VARS IN Pain_Index: (&vars);
%let drawdown= %ranname();
%let stat_mean= %ranname();
%let i = %ranname();
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.
Copyright Info : Copyright (c) 2015 by The Financial Risk Group, Cary, NC, USA.
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. WeAreCAS is an independent community site and is not affiliated with SAS Institute Inc.
This site uses technical and analytical cookies to improve your experience.
Read more.