BookmarkSubscribeRSS Feed
kazimir900
Calcite | Level 5

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

 

2 REPLIES 2
novinosrin
Tourmaline | Level 20
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;
r_behata
Barite | Level 11
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;

SAS Innovate 2025: Call for Content

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!

Submit your idea!

SAS Enterprise Guide vs. SAS Studio

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 589 views
  • 0 likes
  • 3 in conversation