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

From sasCommunity
Jump to: navigation, search
%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(chapter4.downloadfestival2, day3);