How to transpose Please Help.

#1
Hi I have just started working on SAS and I am a beginner..
Please help me how to transpose a simple data from rows to columns..
for ex:

I have

PID 1 2 3 4 5 6 7 8
patient a b c d e f g h
room 001 002 003 004 005 006 007 008

I want to have it like

PID Patient Room
1 a 001
.
.
.
.
8 h 008
 
#2
I’m going to assume that your first column (“PID”, “patient”, “room”) is called “VarName”, that the remaining eight columns are called “X1”, “X2”, … “X8” and that all the columns are text variables, not numeric. They are in a SAS dataset called “Test”. The following code should produce the desired result in a new dataset called “Test_T”:
Code:
proc transpose data = Test out = Test_T (drop = _NAME_);
  id  VarName;
  var X1 X2 X3 X4 X5 X6 X7 X8;  /* NOTE: Could also use "var X1-X8;" */
run;
 
#3
Thank you so much con tester...


QUOTE=Con-Tester;153059]I’m going to assume that your first column (“PID”, “patient”, “room”) is called “VarName”, that the remaining eight columns are called “X1”, “X2”, … “X8” and that all the columns are text variables, not numeric. They are in a SAS dataset called “Test”. The following code should produce the desired result in a new dataset called “Test_T”:
Code:
proc transpose data = Test out = Test_T (drop = _NAME_);
  id  VarName;
  var X1 X2 X3 X4 X5 X6 X7 X8;  /* NOTE: Could also use "var X1-X8;" */
run;
[/QUOTE]