Hi @Tracy_Bis
Here is an attempt to achieve this:
data have;
infile datalines dlm="09"x;
input Have_PersonID $ Have_Date:$200. Have_Store:$200.;
datalines;
123 04/12/2019,04/12/2019,04/12/2019,04/12/2019,04/12/2019,04/12/2019,04/12/2019,04/12/2019 Tracy's Store,Tracy's Store,Tracy's Store,Tracy's Store,Tracy's Store,Tracy's Store,Tracy's Store,Tracy's Store
457 07/05/2019,07/05/2019,07/05/2019,07/05/2019,07/05/2019,07/05/2019,07/05/2019,07/05/2019,07/05/2019,07/05/2019,07/05/2019,07/05/2019,07/05/2019,07/05/2019 ,,,,,,,,,,,,,,
789 03/19/2019,03/19/2019,03/19/2019,03/19/2019,03/19/2019,03/19/2019,03/19/2019,03/19/2019,03/19/2019 ,,,,,,,,,
101 05/18/2019,05/18/2019 Mickeys,Mickeys
234 08/02/2019,08/02/2019,08/02/2019,08/02/2019,08/02/2019,08/02/2019,08/02/2019,08/02/2019,08/02/2019,08/02/2019 Donalds, ND,Donalds, ND,Donalds, ND,Donalds, ND,Donalds, ND,Donalds, ND,Donalds, ND,Donalds, ND,Donalds, ND,Donalds, ND
557 05/19/2019,05/19/2019,05/19/2019,05/19/2019,05/30/2019,05/30/2019,05/30/2019 Daisy's, TX,Daisy's, TX,Daisy's, TX,Daisy's, TX,Pluto, MT,Pluto, MT,Pluto, MT
891 06/21/2019,06/21/2019,06/21/2019,07/10/2019 Hewy, Dewy, And Lewy,Hewy, Dewy, And Lewy,Hewy, Dewy, And Lewy,Goofy, Daffy, And Minnie
;
run;
%macro _mymac(param);
data _have_¶m. (keep= Have_PersonID have_¶m._i i);
set have;
do i=1 to countw(Have_¶m.);
have_¶m._i = scan(Have_¶m.,i,",");
if not missing(have_¶m._i) then output _have_¶m.;
end;
run;
proc sort data=_have_¶m. nodupkey;
by Have_PersonID have_¶m._i;
run;
proc sort data=_have_¶m.;
by Have_PersonID i;
run;
proc transpose data=_have_¶m. out=_have_¶m._tr (drop=_:);
var have_¶m._i;
by Have_PersonID;
run;
data _have_¶m._final;
set _have_¶m._tr;
length have_¶m._i $ 200;
want_¶m. = catx(", ", of col:);
keep Have_PersonID want_¶m.;
run;
%mend;
%_mymac(date)
%_mymac(store)
data want;
merge _have_date_final _have_store_final;
by Have_PersonID;
run;
Output:
All the best,
... View more