proc ttest data=anorexia (where=(treat in ("Cont","CBT")));
class treat;
var prewt;
run;
/* equal variance */
proc mixed data=anorexia (where=(treat in ("Cont","CBT")));
class treat;
model prewt = treat;
run;
/* unequal variance */
proc mixed data=anorexia (where=(treat in ("Cont","CBT")));
class treat;
model prewt = treat / DDFM=Satterthwaite;
repeated / group=treat;
run;
Saturday, July 25, 2009
Independent t-test with PROC MIXED
Friday, July 24, 2009
Paired t-test with PROC MIXED
proc import datafile="C:\projects\Endocrine\CGMS\data\ex\anorexia.csv" out=anorexia
dbms=csv replace; getnames=yes;
run;
proc sql;
create table cbt_long as
select var1 as patient, 0 as time, prewt as y
from anorexia (where=(treat="CBT"))
union
select var1 as patient, 1 as time, postwt as y
from anorexia (where=(treat="CBT"))
;quit;
proc mixed data= cbt_long;
class patient;
model y = time / s;
random patient;
* repeated / subject=patient type=cs rcorr;
run;
/* Paired t-test with SQL */
proc sql;
select t(postwt-prewt) as t, prt(postwt-prewt) as p_value
from anorexia (where=(treat="CBT"))
;quit;
PROC SQL: functions
COUNT, FREQ, N: number of nonmissing values
NMISS: number of missing values
MIN: smallest value
MAX: largest value
RANGE: range of values
SUM: sum of values
SUMWGT: sum of the WEIGHT variable values(footnote 1)
AVG, MEAN: means or average of values
T: Student's t value for testing the hypothesis that the population mean is zero
PRT: probability of a greater absolute value of Student's t
USS: uncorrected sum of squares
CSS: corrected sum of squares
VAR: variance
STD: standard deviation
STDERR: standard error of the mean
CV: coefficient of variation (percent)
NMISS: number of missing values
MIN: smallest value
MAX: largest value
RANGE: range of values
SUM: sum of values
SUMWGT: sum of the WEIGHT variable values(footnote 1)
AVG, MEAN: means or average of values
T: Student's t value for testing the hypothesis that the population mean is zero
PRT: probability of a greater absolute value of Student's t
USS: uncorrected sum of squares
CSS: corrected sum of squares
VAR: variance
STD: standard deviation
STDERR: standard error of the mean
CV: coefficient of variation (percent)
Thursday, July 16, 2009
array & output
%let ntime=288;
data series (drop=j);
array c(30) ;
array s(30);
do time=1 to &ntime;
do j=1 to 30;
c[j]=cos(2*3.141593*j* time/&ntime); s[j]=sin(2*3.141593*j* time/&ntime);
end;
output;
end;
run;
Subscribe to:
Posts (Atom)