Alternatively you can do this. It is not as efficient, but it ensures that every relevant year is actually present for each firm.
data have;
length code $10;
code='one';
do year=2000 to 2015;
cashflow=rand('integer', 1000, 10000);
output;
end;
code='two';
do year=2000 to 2013;
cashflow=rand('integer', 1000, 10000);
output;
end;
code='three';
do year=2000 to 2015;
cashflow=rand('integer', 1000, 10000);
output;
end;
run;
proc sort data=have;
by code;
run;
proc transpose data=have out=temp prefix=year;
by code;
id year;
var cashflow;
run;
data want(keep=code year cashflow);
set temp;
array years{*} year2000-year2015;
if nmiss(of years[*])=0 then do i=1 to dim(years);
cashflow=years[i];
year=input(compress(vname(years[i]), '0123456789', 'k'), 8.);
output;
end;
run;