Date: Thu, 7 Dec 2006 22:10:02 -0800
Reply-To: felice.rando@GMAIL.COM
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: felice.rando@GMAIL.COM
Organization: http://groups.google.com
Subject: Re: concatenating
In-Reply-To: <BAY123-F23A73486324937AE6956E3DED30@phx.gbl>
Content-Type: text/plain; charset="us-ascii"
cheers mate, seems to do the trick!
toby dunn wrote:
> Data Have ;
> Infile Cards ;
> Input Var1 $ Var2 ;
> Cards ;
> Blah1 1
> Blah2 1
> Blah1 2
> ;
> Run ;
>
> Data Need ( Drop = Var1 ) ;
> Length Var3 $ 100 ;
> Set Have ;
> By Var2 ;
> Retain Var3 ;
>
> Var3 = CatX( ' ' , Var3 , Var1 ) ;
>
> If Last.Var2 Then Do ;
> Output ;
> Call Missing( Var3 ) ;
> End ;
>
> Run ;
>
>
> Proc Print
> Data = Need ;
> Run ;
>
>
>
>
> Toby Dunn
>
> Quickly, bring me a beaker of wine, so that I may wet my mind and say
> something clever.
> Aristophanes
>
> Wise people, even though all laws were abolished, would still lead the same
> life.
> Aristophanes
>
> You should not decide until you have heard what both have to say.
> Aristophanes
>
>
>
>
>
>
> From: felice.rando@GMAIL.COM
> Reply-To: felice.rando@GMAIL.COM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: concatenating
> Date: Thu, 7 Dec 2006 18:44:42 -0800
>
> I'm looking to aggregate string variables as follows:
>
> a.text looks like the following:
> Notehead seqnum
> blah1 1
> blah2 1
> blah3 2
> etc.
>
> and I would like:
> seqnum body
> 1 "blah1 blah2"
> 2 "blah3"
> etc.
>
>
> I have the following code below which is giving me only the first
> Notehead for each seqnum. its driving me berzerk :-)
>
> any ideas?
>
> data a.textout(keep = seqnum body);
> set a.text (keep=seqnum Notehead);
> by seqnum;
> length body$ 2000;
> retain body;
> if first.seqnum then body=Notehead;
> else body = body || trim(Notehead) || ' ';
> if last.seqnum;
> run;
>
> _________________________________________________________________
> MSN Shopping has everything on your holiday list. Get expert picks by style,
> age, and price. Try it!
> http://shopping.msn.com/content/shp/?ctId=8000,ptnrid=176,ptnrdata=200601&tcode=wlmtagline
|