Date: Fri, 27 Jul 2007 19:14:15 -0400
Reply-To: "Richard A. DeVenezia" <rdevenezia@WILDBLUE.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Richard A. DeVenezia" <rdevenezia@WILDBLUE.NET>
Organization: Internet News Service
Subject: Re: A DATA MANUPULATION QUESTION
toby dunn wrote:
> John ,
>
> Restructuring yoru data as such is 99.99% of the time a very bad
> idea. It hust makes everything harder to mess with. I ussually on
> recomend this for a few reporting instances like when I cant use proc
> report or proc transpose. Other than that I dont recommend this data
> structure.
Concur.
> Now if you absoolutly must have this structure:
>
> Data Need ( Drop = B ) ;
> Length NewB $ 200 ;
> Set Have ;
> By A ;
> Retain NewB ;
>
> NewB = CatX( ',' , NewB , B ) ;
> If Last.A Then Output ;
> Put A= NewB= ;
> Run ;
Ick!
How about this instead...
--------------------------
data nice;
length a 4 b $20;
input A & B & ;
cards;
0001 Choka Moka
0002 Cola Coca
0002 Monro Choca
0002 Hola Boka Loka
0003 Poka
run;
data B_list(drop=b);
do until (last.a);
set nice;
by a;
length blist $200;
blist = catx(',',blist,b);
end;
run;
--------------------------
Richard A. DeVenezia
http://www.devenezia.com/
|