I did not know scan function; it was very nice. If I don't know scan, this is what I would do:
data test;
input name $1. position $50.;
cards;
A P1,P2,P3
B P1
C P1,P2, P3, P4
D P1,P2, P3, P4, P5
E P2, P5
run;
data out(keep=name position position1-position5);
length name $10. position $50.;
length position1-position5 $10.;
array positions[5] $ Position1-Position5;
set test;
rest = position;
do p=1 to 5;
loc = index(rest, ",");
if loc > 0 then do;
positions[p]=substr(rest, 1, loc-1);
rest = substr(rest, loc+1, length(rest));
end;
else do;
positions[p] = rest;
p = 6;
end;
end;
run;