1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
55
56 /* SleepTheHardWay.sas */
57 title "Student's Sleep data with a classical mixed model";
58
59 data bedtime;
60 infile '/folders/myfolders/studentsleep.data.txt' firstobs=2;
61 /* Skip the header */
62 input patient xsleep1 xsleep2;
63 sleepdif = xsleep2-xsleep1;
64
NOTE: The infile '/folders/myfolders/studentsleep.data.txt' is:
Filename=/folders/myfolders/studentsleep.data.txt,
Owner Name=root,Group Name=vboxsf,
Access Permission=-rwxrwx---,
Last Modified=05Jan2016:14:26:25,
File Size (bytes)=544
NOTE: 10 records were read from the infile '/folders/myfolders/studentsleep.data.txt'.
The minimum record length was 47.
The maximum record length was 47.
NOTE: The data set WORK.BEDTIME has 10 observations and 4 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.00 seconds
65 proc print;
66 title2 'Data in multivariate format';
67
NOTE: There were 10 observations read from the data set WORK.BEDTIME.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.04 seconds
cpu time 0.05 seconds
68 proc means n mean stddev t probt;
69 title2 'Matched t-test';
70 var xsleep1 xsleep2 sleepdif;
71
72 /* Make a data table in univariate format */
73
NOTE: There were 10 observations read from the data set WORK.BEDTIME.
NOTE: PROCEDURE MEANS used (Total process time):
real time 0.04 seconds
cpu time 0.03 seconds
74 data unisleep;
75 set bedtime; /* output writes a case */
76 Subject=patient; Drug=1; ExtraSleep=xsleep1; output;
77 Subject=patient; Drug=2; ExtraSleep=xsleep2; output;
78 keep Subject Drug ExtraSleep;
79
NOTE: There were 10 observations read from the data set WORK.BEDTIME.
NOTE: The data set WORK.UNISLEEP has 20 observations and 3 variables.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.01 seconds
80 proc print;
81 title2 'Data in univariate format';
82
NOTE: There were 20 observations read from the data set WORK.UNISLEEP.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.03 seconds
cpu time 0.03 seconds
83 proc glm plots=none;
84 title2 'Repeated measures ANOVA: Compare t = 4.06, p = 0.0028';
85 class Subject Drug;
86 model ExtraSleep = Subject Drug;
87 random Subject / test;
88
89 /* So F = t-squared except for rounding error. */
90
91
92
93 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
105