hello, i'm having troulbe get the table merge with the two different scores which looks like this: this is my code: data exercise4;
input ID $ KneeNumber PreOp OneDay OneWeek OneMonth;
cards;
01 1 0 5 7 10
02 1 0 10 15 15
02 2 3 5 8 10
03 1 0 3 3 3
03 2 0 6 9 9
04 1 0 4 10 10
;
data A (keep=id visit score);
set exercise4;
array x{4} PreOp OneDay OneWeek OneMonth;
do i=1 to 4;
visit = i;
score = x{i};
if kneenumber = 1;
output;
end;
run;
data B (keep=id visit score);
set exercise4;
array x{4} PreOp OneDay OneWeek OneMonth;
do i=1 to 4;
visit = i;
score = x{i};
if kneenumber = 2;
output;
end;
run;
data merged;
merge A B;
by id;
run;
proc print data=merged;
run; and this is my output:
... View more