Procedure features: |
COPY statement |
VAR statement |
|
This example arranges data to make it suitable for either a multivariate
or a univariate repeated-measures analysis.
The data is from Chapter 8, "Repeated-Measures Analysis of Variance,"
in SAS System for Linear Models, Third Edition.
|
options nodate pageno=1 linesize=80 pagesize=40; |
|
data weights;
input Program $ s1-s7;
datalines;
CONT 85 85 86 85 87 86 87
CONT 80 79 79 78 78 79 78
CONT 78 77 77 77 76 76 77
CONT 84 84 85 84 83 84 85
CONT 80 81 80 80 79 79 80
RI 79 79 79 80 80 78 80
RI 83 83 85 85 86 87 87
RI 81 83 82 82 83 83 82
RI 81 81 81 82 82 83 81
RI 80 81 82 82 82 84 86
WI 84 85 84 83 83 83 84
WI 74 75 75 76 75 76 76
WI 83 84 82 81 83 83 82
WI 86 87 87 87 87 87 86
WI 82 83 84 85 84 85 86
; |
|
data split;
set weights;
array s{7} s1-s7;
Subject + 1;
do Time=1 to 7;
Strength=s{time};
output;
end;
drop s1-s7;
run; |
|
proc print data=split(obs=15) noobs;
title 'SPLIT Data Set';
title2 'First 15 Observations Only';
run; |
SPLIT Data Set 1
First 15 Observations Only
Program Subject Time Strength
CONT 1 1 85
CONT 1 2 85
CONT 1 3 86
CONT 1 4 85
CONT 1 5 87
CONT 1 6 86
CONT 1 7 87
CONT 2 1 80
CONT 2 2 79
CONT 2 3 79
CONT 2 4 78
CONT 2 5 78
CONT 2 6 79
CONT 2 7 78
CONT 3 1 78
|
options nodate pageno=1 linesize=80 pagesize=40; |
|
proc transpose data=split out=totsplit prefix=Str; |
|
by program subject;
copy time strength; |
|
var strength;
run; |
|
proc print data=totsplit(obs=15) noobs;
title 'TOTSPLIT Data Set';
title2 'First 15 Observations Only';
run; |
|
TOTSPLIT Data Set 1
First 15 Observations Only
Program Subject Time Strength _NAME_ Str1 Str2 Str3 Str4 Str5 Str6 Str7
CONT 1 1 85 Strength 85 85 86 85 87 86 87
CONT 1 2 85 . . . . . . .
CONT 1 3 86 . . . . . . .
CONT 1 4 85 . . . . . . .
CONT 1 5 87 . . . . . . .
CONT 1 6 86 . . . . . . .
CONT 1 7 87 . . . . . . .
CONT 2 1 80 Strength 80 79 79 78 78 79 78
CONT 2 2 79 . . . . . . .
CONT 2 3 79 . . . . . . .
CONT 2 4 78 . . . . . . .
CONT 2 5 78 . . . . . . .
CONT 2 6 79 . . . . . . .
CONT 2 7 78 . . . . . . .
CONT 3 1 78 Strength 78 77 77 77 76 76 77
| |
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.