Thanks for the quick reply! I've applied the code to two databases I've imported from Excel: Sep2011 and Oct2011. In each database the identifier is called "ContractNo" and the values are called "BalanceOutstanding". So I amended the code as follows: proc sql; create table want as select COALESCE(Sep2011.ContractNo,Oct2011.ContractNo) as ContractNo ,coalesce(Sep2011.BalanceOutstanding,0) as value1, coalesce(Oct2011.BalanceOutstanding,0) as value2 from Sep2011 full join Oct2011 on Sep2011.ContractNo=Oct2011.ContractNo; quit; Unfortunately I'm getting this: 259 proc sql; 260 create table Want2 as 261 select COALESCE(Sep2011.ContractNo,Oct2011.ContractNo) as ContractNo 261! ,coalesce(Sep2011.BalanceOutstanding,0) as value1, coalesce(Oct2011.BalanceOutstanding,0) as 261! value2 262 from Sep2011 full join Oct2011 263 on Sep2011.ContractNo=Oct2011.ContractNo; ERROR: Expression using equals (=) has components that are of different data types. ERROR: The COALESCE function requires its arguments to be of the same data type. 264 quit; I'm not sure if it's because some of the BalanceOutstanding in the databases are 0 or negative. Or maybe I'm missing something obvious?
... View more