Cross Checks

Cross checks are simply verifying that the same data elements obtained from different data sources do match. Be sure that the variable names, other than your by list, are different when merging datasets, otherwise data will be lost in the merge.

Data work.errors;
    Merge work.A work.B;
    By id;
    flag=' ';
    If dobA^=dobB Then flag=Compress(flag||'+dob');
    If genderA^=genderB Then flag=Compress(flag||'+sex');
    If flag^=' ' then output work.errors;
Run;