Chapter Contents

Previous

Next
The TRANSPOSE Procedure

Example 1: Performing a Simple Transposition


Procedure features:
PROC TRANSPOSE statement option:
OUT=

This example performs a default transposition and uses no subordinate statements.


Program

options nodate pageno=1 linesize=80 pagesize=40;
 Note about code
data score;
   input Student $9. +1 StudentID $ Section $ Test1 Test2 Final;
   datalines;
Capalleti 0545 1  94 91 87
Dubose    1252 2  51 65 91
Engles    1167 1  95 97 97
Grant     1230 2  63 75 80
Krupski   2527 2  80 76 71
Lundsford 4860 1  92 40 86
Mcbane    0674 1  75 78 72
;
 Note about code
proc transpose data=score out=score_transposed;
run;



 Note about code
proc print data=score_transposed noobs;
    title 'Student Test Scores in Variables';
run;


Output
In the output data set SCORE_TRANSPOSED, variables COL1 through COL7 contain the individual scores for the students. Each observation contains all the scores for one test. The _NAME_ variable contains the names of the variables from the input data set that were transposed. [HTML Output]
 [Listing Output]


Chapter Contents

Previous

Next

Top of Page

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