1)The most simple way is using PROC SUMMARY, but the limited thing is the max number of row in each 'offerID' group is 100 .
data have;
input offerID degem amnt;
cards;
111123 200 1000
111123 300 2000
111123 400 3000
;
run;
proc sql noprint;
select max(n) into :n
from (select count(*) as n from have group by offerID);
quit;
proc summary data=have;
by offerID;
output out=want(drop=_freq_ _type_) idgroup(out[&n.] (degem amnt)=);
run;
2)My favorite way is using MERGE skill , but that need you to familiar with sas programming.
data have;
input offerID degem amnt;
cards;
111123 200 1000
111123 300 2000
111123 400 3000
;
run;
data temp;
set have;
by offerID;
if first.offerID then n=0;
n+1;
run;
proc sql;
create table level as
select distinct n from temp;
quit;
data _null_;
set level end=last;
if _n_=1 then call execute('data want;merge ');
call execute(catt('temp(where=(n=',n,') rename=(degem=degem_',n,' amnt=amnt_',n,'))'));
if last then call execute(';by offerID; drop n; run;');
run;
... View more