Wednesday, February 18, 2009

SAS Macro for Standard Error of Skewness and Standard Error of Kurtosis

For reasons that are too dull to go into, I wanted to calculate the standard error of skew and standard error of kurtosis in SAS. I did a bit of trawling on the interwebz, and failed to find anything. So I wrote my own, and put it here, in case anyone needs the same thing.

In the last line, change dataset and variable to match your dataset and variable.

%macro seskewkurt(data, variable);

proc means data = &data n skew kurtosis;
var &variable;
output out=outmeans n=n skew=skew kurtosis=kurtosis;
proc print data = outmeans;
data _null_; set outmeans;
call symput('getn', n);
call symput('getkurtosis', kurtosis);
call symput('getskew', skew);
run;

%let seskew=%sysevalf((((6*&getn)*(&getn-1))/((&getn-2)*(&getn+1)*(&getn+3)))**0.5);
%let sekurt=%sysevalf(2*&seskew*((&getn**2*(2-1))/((&getn-3)*(&getn+5)))**0.5) ;
%let zkurt = %sysevalf(&getkurtosis/&sekurt);
%let zskew = %sysevalf(&getskew/&seskew);
%put N is &getn ;
%put Skew is &getskew;
%put SE of skew is &seskew ;
%put Z score of skew is &zskew ;
%put Kurtosis is &getkurtosis ;
%put SE of kurtosis is &sekurt ;
%put Z score of Kurtosis is &zkurt ;

%mend;


%seskewkurt(dataset, variable);

2 Comments:

At June 9, 2009 10:45 AM , Blogger Senith said...

Can you add feedburner so we can follow you by email?

 
At September 9, 2009 6:15 AM , Blogger Vipul said...

sir i want to know formulas of standard error of skewness and standard error of kurtosis

 

Post a Comment

<< Home