Date: Wed, 15 Sep 2010 22:44:49 -0400
Reply-To: Nat Wooding <nathani@VERIZON.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Nat Wooding <nathani@VERIZON.NET>
Subject: Re: How to concatenate character strings??
In-Reply-To: <BAY123-W15B4A8D8D603A34E450B7DDE7A0@phx.gbl>
Content-Type: text/plain; charset="US-ASCII"
Toby
That would work if Kumar does not want any spaces between the various
strings. Since he used a Compbl function in his original code, I risked the
assumption that he wanted to preserve the single spaces. Given that he did
not offer us a sample of what he really wanted, the jury shall remain out.
I hope the weather is moderating in your neck of the woods. We had a
miserable July and August and I have been enjoying the recent cooler
weather.
Nat
_____
From: toby dunn [mailto:tobydunn@hotmail.com]
Sent: Wednesday, September 15, 2010 8:58 PM
To: Nat Wooding; sas-l@listserv.uga.edu
Subject: RE: How to concatenate character strings??
Nat,
How about this:
Data Kumar1 ;
length egdescr1 egdescr2 egdescr3 $10. Newstring $ 100;
egdescr1 = ' abc ';
egdescr2 = ' def';
egdescr3 = 'ghi ';
Newstring = CatS( Of Egdescr: ) ;
Put _All_ ;
Run ;
Toby Dunn
"I'm a hell bent 100% Texan til I die"
"Don't touch my Willie, I don't know you that well"
> Date: Wed, 15 Sep 2010 19:48:43 -0400
> From: nathani@VERIZON.NET
> Subject: Re: How to concatenate character strings??
> To: SAS-L@LISTSERV.UGA.EDU
>
> Kumar
>
> Try the following
>
> Nat Wooding
>
> Data Kumar1 ( rename = ( Newstring = Egdescr ));
> length egdescr1 egdescr2 egdescr3 $10. Newstring $ 100;
>
> egdescr1 = ' abc ';
> egdescr2 = ' def';
> egdescr3 = 'ghi ';
> array able $ egdescr: ;
> do _i_ = 1 to dim( able );
> Newstring = compbl( Newstring || able ( _I_ ) );
> end;
> run;
>
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
> SAS_learner
> Sent: Wednesday, September 15, 2010 7:26 PM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: How to concatenate character strings??
>
> Hello all,
>
> I am trying to concatenate all the description fields from egdescr1 to
> egdescr5 like this
>
> Data test ;
> set supplb;
>
> if EGSTRESC = "ABNORMAL" Then
> Egstresc = Compbl(Strip(Egstresc)!!': '!!Strip(egdescr)!!'
> '!!Strip(egdescr1)!!' '!!compress(egdescr2,,'wk')!!' '!!Strip(egdescr3)!!'
> '!!Strip(egdescr4)!!' '!!Strip(egdescr5));
> Run;
>
> with the new data update egdescr3 ,4,5 has been dropped resulting in NOTE
of
> Uninitialized in the Log . I tried to Use Catx function but with the text
> being long it is giving me kind of error message (beyond 300 ) .
>
> How can dynamically check all the egdescr variables and put them together
> back . I think I did something very similar long time ago using arrays
>
> any Idea?
>
> Thanks for your time and help
>
>
> thanks
> Kumar
|