Same idea @YobachiLiu, use subquery.
- data table1;
- input client $6. paidclaims;
- cards;
- 123456 1000
- 234567 2000
- aaaaaa 3333
- ;
- data table2;
- input client $6. totpaidclaims;
- cards;
- 123456 5000
- 234567 9000
- bbbbbb 2222
- ;
- proc sql;
- update table1
- set paidclaims = (
- select totpaidclaims from table2
- where table1.client=table2.client
- )
- where client in (
- select client from table2
- );
- quit;
复制代码And my previous comment was flawed, 'LEFT JOIN' works fine if used in the SELECT statement.
- proc sql;
- create table table3 as
- select a.client, coalesce(b.totpaidclaims, a.paidclaims) as paidclaims
- from table1 a left join table2 b
- on a.client=b.client;
- quit;
复制代码