Which apart is taking a long time to run. Also, you don't need the first two steps - combine those into your proc sort to help speed things up: proc sort data=hwtest.whq_e out=h477; by seqn; run; And as @pearsoninst mentioned, remove the proc print.
... View more