data stan;
array Key[20] $ _temporary_ ('A','B','C','D','C','B','A','D','B','A','A','C','B','D','D','B','A','A','B','B');
array Question[20] $;
input Student_ID $ Gender $ Question[*];
Scores = 0;
do i = 1 to 20;
if Question[i] eq Key[i] then Scores = 1;
end;
drop i;
datalines;
A1 Female A B A D B C D A A A C D B C A C C B D A
A2 Female B C D A A A B C D A D C D B D A A D C D
A3 Male C C C A A B D B D B C D C D C A A D A A
A4 Male A D A C C C B D C A B A C A D D A B A C
;
proc print data = stan;
title "total correct questions by item";
var Student_ID Scores: ;
run;
I want to score a test for 4 people by using a temporary array. The outputs should show each grade for each student, indicated by a 1 or a 0. However, my current results are completely wrong. I think my problem comes from the proc print part but i don't know where it is wrong. Any help? Thanks in advance!
... View more