Hi, i have two data sets set one ID Type Amount 1 AB 1000 2 AC 2000 3 AD 3000 4 AF 4000 5 AE 5000 set two ID 1 2 3 4 5 In the first data set, observations in variable "type" are a symbol for example AB stands for "loan". Now i want to join these sets on ID and create a new variable based on a type variable from set one. example. data want ID Loan 1 1000 I've tried to do it with case when proc sql; create table transactions as select a.*, (case when b.type='AB' then b.Amount end) as loan from set_one a left join set_two b on a.ID=b.ID; quit; and it works, but I want it to be more efficient and added more "when" proc sql; create table transactions as select a.*, (case when b.type='AB' then b.Amount end) as loan when b.type='AC' then b.Amount end) as debit from set_one a left join set_two b on a.ID=b.ID; quit; it gave me a syntax error, probably cause the end statement in loan step. Is there another way to solve this problem, how can I join these tables ?
... View more