Date: Fri, 27 Jul 2007 02:54:27 -0400
Reply-To: Gerhard Hellriegel <gerhard.hellriegel@T-ONLINE.DE>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Gerhard Hellriegel <gerhard.hellriegel@T-ONLINE.DE>
Subject: Re: A DATA MANUPULATION QUESTION
if you want it in groups, you could do the following:
1. sort the dataset BY A
2. initialize the NEWB variable at every FIRST.A (use BY in the DATA -
step)
like:
....
by a;
if first.a then newb=" ";
...
3. cumulate the values (like in the other examples)
4. test, if the end-of-group is detected. If yes, put it out.
like
...
if last.a then output;
only to give you a explanation of the logic. All other things around
(retain newb, concatenation, ...) stay like before.
Gerhard
On Thu, 26 Jul 2007 14:23:13 -0400, John Edward
<entry_mid_level_sas@YAHOO.COM> wrote:
>Mr. Tobby,
>
>It worked great But I just provided a part of the problem it was my
>mistake. Please look at the dataset and problem more closely:
>
>I have the following dataset with variabel A and B:
>
>A B
>--- -------
>
>0001 Choka Moka
>0002 Cola Coca
>0002 Monro Choca
>0002 Hola Boka Loka
>0003 Poka
>
>
>I will need the following dataset:
>A B
>---- --------------------------------------
>0001 Choka Moka
>0002 Cola Coca, Monro Choca, Hola Boka Loka
>0003 Poka
>
>
>your previous code retaining value of A to the following obsevation B
>and puting "," even in the first observation. I know it is my mistake by
>not giving you more detail problem.
>
>
>Thank you Mr. Toby
|