- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
hi,
I have a dataset like this;
ID A B C D
1 21 45 90 76
1 25 32 78 21
2 34 74 34 89
2 43 88 12 94
2 54 33 77 90
I want to do transposing and the desired o/p will be like
ID _name_ value
1 A 21
1 B 45
1 C 90
1 D 76
1 A 25
1 B 32
1 C 78
1 D 21
2 A 34
2 B 74
2 C 34
2 D 89
...............and so on...
how can i do this?
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
data have;
input ID A B C D;
datalines;
1 21 45 90 76
1 25 32 78 21
2 34 74 34 89
2 43 88 12 94
2 54 33 77 90
;
data want(keep= ID _name_ value);
set have;
array _{4} A B C D;
do i=1 to dim(_);
_name_=vname(_[i]);
value=_[i];
output;
end;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
data have;
input ID A B C D;
datalines;
1 21 45 90 76
1 25 32 78 21
2 34 74 34 89
2 43 88 12 94
2 54 33 77 90
;
data want(keep= ID _name_ value);
set have;
array _{4} A B C D;
do i=1 to dim(_);
_name_=vname(_[i]);
value=_[i];
output;
end;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
thank you somuch. it works
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Anytime, glad to help 🙂