| Date: | Tue, 27 Nov 2001 15:26:03 -0500 |
| Reply-To: | Jay Weedon <jweedon@EARTHLINK.NET> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Jay Weedon <jweedon@EARTHLINK.NET> |
| Organization: | http://extra.newsguy.com |
| Subject: | Re: stacking and transposing |
| Content-Type: | text/plain; charset=us-ascii |
On 27 Nov 2001 11:45:41 -0800, sdoraira@vt.edu (Sundar) wrote:
>I have a data set that looks like this:
> Blue 28 26 31 27 35
> Green 34 29 25 31 29
> Orange 31 25 27 29 28
>
>What's the easiest way to make it look like this:
>Blue 28
>Blue 26
>Blue 31
>Blue 27
>Blue 35
>Green 34
>Green 29
>Green 25
>Green 31
>Green 29
>Orange 31
>Orange 25
>Orange 27
>Orange 29
>Orange 28
>
>I have come up a solution, though it requires 4 data steps and a
>transpose. There's got to be an easier way. Any answer should allow
>for any number of groups, not just 3 as suggested in the question.
Assuming var names are color, x1-x5.
Sort file by color if nec. Then
proc transpose data=t out=t2; by color; var x1-x5; run;
JW
|