| Date: | Fri, 6 Aug 2010 06:30:31 -0400 |
| Reply-To: | Jeff <zhujp98@GMAIL.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Jeff <zhujp98@GMAIL.COM> |
| Subject: | Re: how to turn multiple rows into one row in group? |
|
| In-Reply-To: | <201008060912.o75K9kdZ026341@willow.cc.uga.edu> |
| Content-Type: | text/plain; charset=ISO-8859-1 |
|---|
Thanks, I will try it.
Jeff
On Fri, Aug 6, 2010 at 5:12 AM, Jim Groeneveld <jim.1stat@yahoo.com> wrote:
> Hi Jeff,
>
> Try to use the macro %MR2RM as follows:
> %MR2RM (Data=t1, Out=Result, Overwrit=Y, ByList=ID)
>
>
> http://listserv.uga.edu/cgi-bin/wa?S2=sas-l&D=1&O=D&q=mr2rm&s=&f=jim&a=2000&b=
>
> Regards - Jim.
> --
> Jim Groeneveld, Netherlands
> Statistician/SAS consultant
> http://jim.groeneveld.eu.tf
>
> On Thu, 5 Aug 2010 20:09:09 -0400, Jeff <zhujp98@GMAIL.COM> wrote:
>
> >data t1;
> >input id a b;
> >cards;
> >1 2 3
> >1 4 5
> >1 6 7
> >1 2 4
> >1 4 15
> >1 6 8
> >2 1 2
> >2 1 4
> >3 6 7
> >3 8 7
> >3 9 10
> >3 7 12
> >;
> >run;
> >proc sort data=t1;
> >by id;
> >run;
> >
> >data t2;
> >set t1;
> >by id;
> >retain n(0);
> >if first.id then n=1;
> >else n=n+1;
> >run;
> >
> >
> >I want resulting dataset
> >id a1 b1 a2 b2 a3 b3 a4 b4 a5 b5 a6 b6 a.....
> >1 2 3 4 5 6 7 2 4 4 15 6 8
> >2 1 2 1 4
> >3 6 7 8 7 9 10 7 12
> >
> >How can I do that?
> >Thanks,
> >Jeff
>
|