I think this is what you want but my results do not match your expectation exactly. You do this by looking ahead by usually "I think" it is done by looking back.
[pre]
dm 'clear log; clear output;';
data cars;
input
Obs VehicleNumber :$8. EntryDateTime & datetime. GateID:$1.;
format E: dateampm19.;
drop obs;
cards;
1 SGG9274A 12-Jan-07 02:18:27 AM A
2 SSC7789N 16-May-07 04:45:58 PM B
3 SSC7989N 16-May-07 11:00:29 PM B
4 SSC7989N 05-Jul-07 06:33:38 PM B
5 SSC7989N 18-Jul-07 12:22:53 PM C
6 STM1209B 28-Feb-07 05:07:31 AM A
7 SVX3120C 06-Sep-07 09:29:20 AM A
8 SVX3120C 21-Sep-07 07:23:48 AM C
9 SVX3120C 21-Sep-07 07:55:28 AM C
10 SVY3542N 09-Mar-07 03:06:24 PM B
11 SVY3542N 19-Mar-07 12:21:02 AM B
;;;;
run;
proc sort;
by V: E:;
run;
data cars;
do until(last.VehicleNumber);
set cars;
by v: E:;
FromGate = lag(GateID);
RunTime = dif(EntryDateTime);
ToGate = GateID;
if first.VehicleNumber then call missing(of FromGate RunTime);
if not first.VehicleNumber then output;
end;
format runTime comma12.;
drop Entry: GateID;
drop
run;
proc print;
by v:;
id v:;
run;
Vehicle From To
Number Gate RunTime Gate
SSC7989N B 4,303,989 B
B 1,100,955 C
SVX3120C A 1,288,468 C
C 1,900 C
SVY3542N B 810,878 B
[pre]