I believe you are doing a cartesian comparison of the Nr cases in r vs the Nd cases in d. Even if Nr=Nd (=N) and every cost center was present in both , you'd still have N*N - N observations with a value of wrongcentre =1.
What I really think you wnat is a list of centre's present in only one of the two data sets. If so, I'd suggest this:
proc sql;
create table DQ as
select rcostcentre, costcentredq from
data.resources as r full outer join valibla.dq_res as d
on r.costcentre=d.costcentredq
except
select rcostcentre, costcentredq from
data.resources as r inner join valibla.dq_res as d
on r.costcentre=d.costcentredq;
quit;
I did a test of this with sashelp.names:
data class1 (rename=(name=name1)) class2 (rename=(name=name2));
set sashelp.class (keep=name) end=eoc;
output class1;
if name='William' then name='XXXXX';
output class2;
run;
proc sql;
create table test as
select name1, name2 from
class1 FULL JOIN class2 on name1=name2
EXCEPT
select name1, name2 from
class1 INNER JOIN class2 on name1=name2;
quit;
... View more