Date: Thu, 14 Jul 2005 12:46:46 -0400
Reply-To: Talbot Michael Katz <topkatz@MSN.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Talbot Michael Katz <topkatz@MSN.COM>
Subject: Re: A question about proc transpose
Hi, smartie_zhuo.
It's not clear to me why you need PROC TRANSPOSE. If you keep everything
in one column, you've got the original structure of your data set. If you
want to rename the original variable, num, to COL1 and add a new variable
called _NAME_ with constant value "num" you could do:
data c;
set a (rename = (num = COL1));
_NAME_ = "num";
run;
This gives the same data set as what you asked for, but I doubt that's all
you want. Perhaps you could describe what you need more fully?
-- TMK --
"The Macro Klutz"
On Thu, 14 Jul 2005 09:28:47 -0700, smartie_zhuo@HOTMAIL.COM wrote:
>Hi,
>Thanks in advance.
>I have a following program.
>
>
>data a;
>input id1 id2 num;
>datalines;
>1 2 3
>2 3 4
>2 3 5
>;
>run;
>proc transpose data=a out=c ;
>by id1 id2;
>var num;
>run;
>proc print data=c;
>run;
>
>The outcome has two col,"col1' and "col2".
>
> Obs id1 id2 _NAME_ COL1 COL2
>
> 1 1 2 num 3 .
> 2 2 3 num 4 5
>
>I know it is because duplicate observation.
>My question is can I force the sas only create one Column,no matter
>whether the dataset has duplicated obs like this"
>
> Obs id1 id2 _NAME_ COL1
> 1 1 2 num 3
> 2 2 3 num 4
> 3 2 3 num 5
>
>
>Thanks
|