I agree with you @novinosrin, the code could simplified in one step proc sql as below
proc sql;
create table want as select year(date) as year, sum(units) as sum from sashelp.countseries group by year;
quit;
... View more
/*** UNTESTED CODE ***/
data want;
infile "filename.txt";
input name $10. & datetime :ANYDTDTM16.;
date=datetpart(datetime);
time=timepart(datetime);
format date ddyymm8. time timeampm8.;
run;
... View more