How to transpose two variable together in SAS?

sas

#1

Hi,

I have below data set and I want to transpose two variables at the same time “Score” and “Grade”.

Input Data Set:

ID Score Grade
A 9 A
A 5 B
B 8 A
B 3 C

I want to transpose it as follows:

ID	Score1	Score2	Grade1	Grade2
A	9	5	A	B
B	8	3	A	C

Currently, I’m transposing one variable at a time and then merging the two data sets. Could this be done in one step?

Pls help!


#2

@Karan, i think thats the only way we can perform transpose on two variables as u said, separately and then merge…
still working on it, will post soon.


#3

@karan we cannot give 2 variables in the ID statement because of that may be unable to get ID of both score and grade as variable’s.
only 1 ID per transpose limitation.
may be possible in arrays for any no. of variable’s.

hope i answered the question.