Chapter Contents

Previous

Next
The TRANSPOSE Procedure

Example 6: Transposing Data for Statistical Analysis


Procedure features:
COPY statement
VAR statement

This example arranges data to make them suitable for either a multivariate or univariate repeated-measures analysis.

The data are from Chapter 8, "Repeated-Measures Analysis of Variance" in SAS System for Linear Models, Third Edition.


Program 1

options nodate pageno=1 linesize=80 pagesize=40;
 Note about code
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
;
 Note about code
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;
 Note about code
proc print data=split(obs=15) noobs;
   title 'SPLIT Data Set';
   title2 'First 15 Observations Only';
run;


Output 1
[HTML Output]  [Listing Output]


Program 2

options nodate pageno=1 linesize=80 pagesize=40;
 Note about code
proc transpose data=split out=totsplit prefix=Str;
 Note about code
   by program subject;
   copy time strength;










 Note about code
   var strength;
run;
 Note about code
proc print data=totsplit(obs=15) noobs;
   title  'TOTSPLIT Data Set';
   title2 'First 15 Observations Only';
run;


Output 2
The variables in TOTSPLIT with missing values are used only in a multivariate repeated-measures analysis. The missing values do not preclude this data set from being used in a repeated-measures analysis because the MODEL statement in PROC GLM ignores observations with missing values. [HTML Output]
 [Listing Output]


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.