This macro calculates the Martin Ratio by dividing the annualized excess return by the Ulcer Index. It orchestrates calls to several utility macros (%return_excess, %return_annualized, %Ulcer_Index) and combines the results via a DATA step using the LAG function to perform the division between the stacked results.
Data Analysis
Type : EXTERNAL
Input data is provided via the macro parameter 'returns'.
1 Code Block
MACRO
Explanation : Definition of the macro accepting data parameters (returns), risk-free rate (Rf), time scale, and calculation method.
Explanation : Stacks annualized results and the Ulcer Index. Uses the LAG function to divide the value from the first table (return) by that from the second (risk) to obtain the ratio.
Copied!
data &outData (drop= &i);
set &annualized &ulcer_index;
array Ulcer[*] &vars;
do &i= 1 to dim(Ulcer);
Ulcer[&i]= lag(Ulcer[&i])/Ulcer[&i];
end;
run;
1
DATA &outData (drop= &i);
2
SET &annualized &ulcer_index;
3
array Ulcer[*] &vars;
4
DO &i= 1 to dim(Ulcer);
5
Ulcer[&i]= lag(Ulcer[&i])/Ulcer[&i];
6
END;
7
RUN;
4 Code Block
DATA STEP Data
Explanation : Finalization of the output table: adding the '_STAT_' label and keeping only the last observation containing the calculated ratio.
Copied!
data &outData;
format _stat_ $32.;
set &outData end= last;
_STAT_= 'Martin Ratio';
if last;
run;
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.