1
votes

I'm interested in calculating the skewness of a dataset in SAS. Using the proc univariate statement I can get summary statistics, thus the skewness. Is it possible to get just the value of the skewness as output? I also need that value to do some calculations in the next lines, therefore I'll need a way to acces just that value, not all the summary statistics.

1

1 Answers

2
votes

You can get the list of what's available with ods trace.

ods trace on;
proc univariate data=sashelp.class;
  var age;
run;
ods trace off;

Moments is the table that contains skewness; you can use KEEP statements and/or WHERE statements to filter to just that value.

ods output moments=class_moments;
proc univariate data=sashelp.class;
  var age;
run;
ods output close;

And then the keep statements particular to skewness:

ods output moments=class_moments(keep=varname cValue1 label1 where=(label1='Skewness'));
proc univariate data=sashelp.class;
  var age;
run;
ods output close;