/* one-sample t-test에서 사용된 alcohol을 이용해서 proc sql에서 함수로 구할 수 있는 기술통계량을 모두 구해봤습니다 */
/* uss()는 uncorrected sum of squares인데 그냥 제곱합입니다. */
/* css()는 corrected sum of square인데, 값에서 평균을 빼서 correct한 값들의 제곱합입니다. */
data alcohol;
input y @@;
datalines;
15.5 11.21 12.67 8.87 12.15 9.88 2.06 14.5 0 4.97
;
proc sql;
select count(y) "sample size",
nmiss(y) "# of missing",
sum(y) "sum", avg(y) "mean", var(y) "variance",
std(y) "standard deviation", stderr(y) "standard error",
min(y) "min", max(y) "max", range(y) "range", cv(y) "coefficient of variation",
css(y) "corrected SS", uss(y) "uncorrected SS",
t(y), prt(y)
from alcohol
; quit;
첫댓글 잘 보겠습니다. sql이 잘 쓰면 정말 편하더군요.
저는 data step 거의 안쓰고 있습니다. data step에서는 print 하려면 데이터로 만들어 proc print 해야하는데 sql은 그냥 되거든요.