Data checkname;
set my.cohort_patuniq;

if UPCASE(SUBSTR(lastname,1,3)) NE UPCASE(SUBSTR(last_name,1,3)) and
dob ne birthdt then output;   *if last name and date of birth don’t match;

else if UPCASE(SUBSTR(firstname,1,3)) NE
UPCASE(SUBSTR(first_name,1,3)) then output; *if first names don’t match;

run;