From: Reeza on
On Jul 15, 1:09 pm, Carl Kaufmann <cwkaufm...(a)cox.net> wrote:
> On 2010-07-15 15:38, Reeza wrote:
>
>
>
>
>
> > Hi,
>
> > I have string data like this:
>
> > A
> > B
> > C
> > D
>
> > and I want the results to look like this:
> > var   combined
> > A    A
> > B    AB
> > C    ABC
> > D    ABCD
>
> > I tried a simple retain with cat and || in SAS but it didn't seem to
> > work.
>
> > ie
>
> > data want;
> > set have;
> > retain combined;
> > combined=cat(combined, var);
> > run;
>
> > Any help appreciated.
>
> > Thanks,
> > Reeza
>
> You need a LENGTH statement to make sure the COMBINED variable can
> hold the longest string encountered, e.g. LENGTH COMBINED $ 200
>
> Carl- Hide quoted text -
>
> - Show quoted text -

Thanks, I wasn't resetting the variable at the right point so it was
getting too big.

Reeza