Hey Guys,
i have the following problem. I have a table like this:
Contract ID Company Account-Action Amount
A12345 XXXXX Provision 30,00
A12345 XXXXX Outstanding 450,00
B12345 YYYYY .....
Now I'd like to transpose this table to:
Contract ID Company Provision Outstanding
A12345 XXXXX 30,00 450,00
B12345 YYYYY .....
Thanks a lot for yout help!!!
Lars
data have;
input (ContractID Company Account_Action Amount) (:$20.);
cards;
A12345 XXXXX Provision 30,00
A12345 XXXXX Outstanding 450,00
;
proc transpose data=have out=want(drop=_name_);
by ContractID Company ;
id Account_Action;
var amount;
run;
data have;
input (ContractID Company Account_Action Amount) (:$20.);
infile cards truncover;
cards;
A12345 XXXXX Provision 30,00
A12345 XXXXX Outstanding 450,00
B12345 YYYYY
;
run;
data want;
set have;
by ContractID;
retain Provision Outstanding;
format Provision Outstanding comma8.2;
array var[*] 8 Provision Outstanding;
i=1;
if first.ContractID then
do;
call missing(Provision,Outstanding);
var[i]=input(Amount,comma8.2);
end;
else
do;
i+1;
var[i]=input(Amount,comma8.2);
end;
if last.ContractID ;
keep ContractID Company Provision Outstanding;
run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.