Here is a solution. Hope it helps.
Note:
1. If sample size are the same for each of the group, just replace the number in n=
2. If sample size varies, then there must be some flag indicating the group number, you can skip the part of "Define Group Indicator"
3. The program assumes the correct code value appears most so it is the "Mode" of each group
%let n=10;
data ds;
input obs code ;
cards;
1 1000
2 1000
3 1000
4 1020
5 1000
6 1000
7 1110
8 1000
9 1000
10 1000
11 1001
12 1001
13 1001
14 1023
15 1001
16 1001
17 1001
18 1024
19 1222
20 1001
;
run;
/* Define Group Indicator*/
data ds;
set ds;
grp=floor((obs-1)/&n)+1;
run;
/* End Define Group Indicator*/
proc means data=ds mode noprint;
by grp;
output out=dsmode(keep=grp code rename=(code=mode)) mode=;
run;
data ds3;
merge ds dsmode;
by grp;
run;
data ds4;
set ds3;
Error=(code ne mode);
code_correct=mode;
run;