I'm not going to try to rewrite all of your code, but I still don't see anything that stops working if you do it all at once. You might need to add in something to your SQL so it operates by race_number rather than expecting a single race number, but this output data set ONET from my brief code should be usable in its entirety in each of your subsequent steps.
data have;
input Race_number (time_lynn time_cato time_drum time_pine time_sher time_fini) (time8.);
cards;
28951 6:28:53 7:22:32 8:13:22 9:40:28 10:24:47 11:00:37
17472 6:28:52 7:22:29 8:13:22 9:40:28 10:25:52 11:03:45
54169 6:29:31 7:22:32 8:13:23 9:42:11 10:30:13 11:06:24
31020 6:28:52 7:22:30 8:13:23 9:42:51 10:31:07 11:08:06
19952 6:28:53 7:22:33 8:13:32 9:47:14 10:35:03 11:11:35
30807 6:28:54 7:22:33 8:13:25 9:41:33 10:31:41 11:13:27
28773 6:28:52 7:22:32 8:13:24 9:41:07 10:29:52 11:14:56
44452 6:29:10 7:22:39 8:13:31 9:49:06 10:38:40 11:16:09
56834 6:28:53 7:22:28 8:15:04 9:51:15 10:40:29 11:17:03
29774 6:28:54 7:22:33 8:13:27 9:42:18 10:36:43 11:17:19
;
proc transpose data=have prefix=time out=onet;
by race_number notsorted;
run;
... View more