|
Thanks for all your reply. Yes, I should use
transpose to do this. For some reason, I was stuck
with array at the time I was thinking about doing
this. It is much easier using transpose do this.
--- Christoph.Helwig@quintiles.com wrote:
>
> data a;
> input id name $1.;
> cards;
> 1 a
> 1 b
> 1 c
> 1 d
> 2 a
> 2 c
> 3 d
> 3 c
> 3 a
> 5 e
> ;
> run;
>
> proc transpose out=b prefix=name;
> by id;
> var name;
> run;
>
>
>
>
>
> lily padula <lily6935@YAHOO.COM>@LISTSERV.UGA.EDU>
> on 21/08/2002 14:57:44
>
> Please respond to lily padula <lily6935@YAHOO.COM>
>
> Sent by: "SAS(r) Discussion"
> <SAS-L@LISTSERV.UGA.EDU>
>
>
> To: SAS-L@LISTSERV.UGA.EDU
> cc: (bcc: Christoph Helwig/QFFM/Quintiles)
>
> Subject: How to use array to transpose variable
> values as columns
>
>
> I have the following data set:
>
>
> data a;
> input id name $1.;
> cards;
> 1 a
> 1 b
> 1 c
> 1 d
> 2 a
> 2 c
> 3 d
> 3 c
> 3 a
> 5 e
> ;
> run;
>
> And I would like to have a data set to be organized
> like this:
>
> id name1 name2 name3 name4
> 1 a b c d
> 2 a c
> 3 d c a
> 5 e
>
> In other words, the id is a random number and each
> id could have n names.
> I
> would like to create a file that has one row for
> each id and transpose the
> value of variable 'name' into coulumns, named as
> name1, name2, name2, and
> etc.
>
> Any idea about this? Thanks in advance.
>
> Lily
>
>
>
>
>
>
>
>
>
>
>
**************************************************************************************************
> The contents of this email and any attachments are
> confidential.
> It is intended for the named recipient(s) only.
> If you have received this email in error please
> notify the system manager or the
> sender immediately and do not disclose the contents
> to any one or make copies.
>
> ** eSafe scanned this email for viruses, vandals and
> malicious content **
>
**************************************************************************************************
>
__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com
|