Prev: 10% off "Power User's Guide to SAS Programming" from Lulu.com until July 31
Next: exponential notaion
From: Reeza on 15 Jul 2010 17:28 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 |