data a;
filename a 'aus93.dat';
infile a;
length lname fname district $ 30;
input year state $ district & enrolled lname & fname & position
inc party $ countn votes;
run;
proc sort; by year district lname fname countn; run;
data a;
set a; by year district lname fname countn;
if first.fname then do; v1=.; v2=.; v3=.; v4=.; v5=.;
v6=.; v7=.; v8=.; v9=.; v10=.; end;
if countn=1 then v1=votes;
if countn=2 then v2=votes;
if countn=3 then v3=votes;
if countn=4 then v4=votes;
if countn=5 then v5=votes;
if countn=6 then v6=votes;
if countn=7 then v7=votes;
if countn=8 then v8=votes;
if countn=9 then v9=votes;
if countn=10 then v10=votes;
retain v1-v10;
drop votes;
if last.fname then output;
run;