Egodym
Egodym

Reputation: 451

Selecting a particular output value in SAS proc univariate

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.

Upvotes: 1

Views: 1588

Answers (1)

Joe
Joe

Reputation: 63434

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;

Upvotes: 2

Related Questions