To analyze output from the bevent program, it helps to input the data into a database.  I prefer to use MySQL.  Here’s how.

1) Create a database table.

CREATE TABLE `bevent` (
`gameid` varchar(12) NOT NULL,
`vteam` varchar(3) NOT NULL,
`inning` int(3) NOT NULL,
`battingteam` int(1) NOT NULL,
`outs` int(1) NOT NULL,
`balls` int(1) NOT NULL,
`strikes` int(1) NOT NULL,
`pitchsequence` varchar(25) NOT NULL,
`vscore` int(2) NOT NULL,
`hscore` int(2) NOT NULL,
`batter` varchar(10) NOT NULL,
`batterhand` varchar(2) NOT NULL,
`resbatter` varchar(10) NOT NULL,
`resbatterhand` varchar(2) NOT NULL,
`pitcher` varchar(10) NOT NULL,
`pitcherhand` varchar(2) NOT NULL,
`respitcher` varchar(10) NOT NULL,
`respitcherhand` varchar(2) NOT NULL,
`catcher` varchar(10) NOT NULL,
`firstbase` varchar(10) NOT NULL,
`secondbase` varchar(10) NOT NULL,
`thirdbase` varchar(10) NOT NULL,
`shortstop` varchar(10) NOT NULL,
`leftfield` varchar(10) NOT NULL,
`centerfield` varchar(10) NOT NULL,
`rightfield` varchar(10) NOT NULL,
`firstrunner` varchar(10) NOT NULL,
`secondrunner` varchar(10) NOT NULL,
`thirdrunner` varchar(10) NOT NULL,
`eventtext` varchar(30) NOT NULL,
`leadoff` varchar(1) NOT NULL,
`pinchhit` varchar(1) NOT NULL,
`defensiveposition` int(2) NOT NULL,
`lineupposition` int(2) NOT NULL,
`eventtype` int(4) NOT NULL,
`battereventflag` varchar(1) NOT NULL,
`abflag` varchar(1) NOT NULL,
`hitvalue` int(1) NOT NULL,
`shflag` varchar(1) NOT NULL,
`sfflag` varchar(1) NOT NULL,
`outsonplay` int(1) NOT NULL,
`doubleplayflag` varchar(1) NOT NULL,
`tripleplayflag` varchar(1) NOT NULL,
`rbionplay` int(1) NOT NULL,
`wildpitchflag` varchar(1) NOT NULL,
`passedballflag` varchar(1) NOT NULL,
`fieldedby` int(2) NOT NULL,
`battedballtype` varchar(2) NOT NULL,
`buntflag` varchar(1) NOT NULL,
`foulflag` varchar(1) NOT NULL,
`hitlocation` varchar(5) NOT NULL,
`numerrors` int(1) NOT NULL,
`firsterror` int(1) NOT NULL,
`firsterrortype` varchar(2) NOT NULL,
`seconderror` int(1) NOT NULL,
`seconderrortype` varchar(2) NOT NULL,
`thirderror` int(1) NOT NULL,
`thirderrortype` varchar(2) NOT NULL,
`batterdest` int(2) NOT NULL,
`firstdest` int(2) NOT NULL,
`seconddest` int(2) NOT NULL,
`thirddest` int(2) NOT NULL,
`playonbatter` varchar(8) NOT NULL,
`playonfirst` varchar(8) NOT NULL,
`playonsecond` varchar(8) NOT NULL,
`playonthird` varchar(8) NOT NULL,
`sbfirst` varchar(1) NOT NULL,
`sbsecond` varchar(1) NOT NULL,
`sbthird` varchar(1) NOT NULL,
`csfirst` varchar(1) NOT NULL,
`cssecond` varchar(1) NOT NULL,
`csthird` varchar(1) NOT NULL,
`pofirst` varchar(1) NOT NULL,
`posecond` varchar(1) NOT NULL,
`pothird` varchar(1) NOT NULL,
`respfirst` varchar(10) NOT NULL,
`respsecond` varchar(10) NOT NULL,
`respthird` varchar(10) NOT NULL,
`newgame` varchar(1) NOT NULL,
`endgame` varchar(1) NOT NULL,
`pinchfirst` varchar(1) NOT NULL,
`pinchsecond` varchar(1) NOT NULL,
`pinchthird` varchar(1) NOT NULL,
`removefirst` varchar(10) NOT NULL,
`removesecond` varchar(10) NOT NULL,
`removethird` varchar(10) NOT NULL,
`removebatter` varchar(10) NOT NULL,
`removebatterpos` int(2) NOT NULL,
`fielder1` int(2) NOT NULL,
`fielder2` int(2) NOT NULL,
`fielder3` int(2) NOT NULL,
`assist1` int(2) NOT NULL,
`assist2` int(2) NOT NULL,
`assist3` int(2) NOT NULL,
`assist4` int(2) NOT NULL,
`assist5` int(2) NOT NULL,
`eventnum` int(4) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

2. Download the Retrosheet zip files, and run the beventprogram.  If you setup your database with fields 0-96, make sure you output all fields with bevent.

bevent -y 2008 -f 0-96 2008ANA.EVA 2008BAL.EVA 2008CHA.EVA 2008DET.EVA 2008OAK.EVA 2008SEA.EVA 2008TBA.EVA 2008TOR.EVA 2008ARI.EVN 2008ATL.EVN 2008CHN.EVN 2008CIN.EVN 2008COL.EVN 2008FLO.EVN 2008HOU.EVN 2008LAN.EVN 2008MIL.EVN 2008NYN.EVN 2008PHI.EVN 2008SDN.EVN 2008SFN.EVN 2008SLN.EVN 2008WAS.EVN 2008BOS.EVA 2008CLE.EVA 2008KCA.EVA 2008MIN.EVA 2008PIT.EVN > 2008COMBINED.csv

3. Import 2008COMBINED.csv into your new MySQL database table.

Retrosheet’s bevent program takes a Retrosheet event file and creates a complete description of every at-bat that occurred during the game.  To complete the introduction of Retrosheet’s three pieces of software, I’ll once again start with the event file for the Colorado Rockies @ Los Angeles Dodgers game on 4/9/2007 as an example. Here is the event file.

Here is a step-by-step guide for using bevent.exe.

  1. Download bevent.exe from Retrosheet or here, and unzip the executable file.
  2. Put the event file (or a text file that includes many event files) in the same directory as the bevent.exe program.
  3. You also need to have a team file included in the same directory.  A team file is text file that lists every team, their league, and their three-letter abbreviation.  The team file must have a filename of TEAMYYYY.  For example, here is TEAM2007.
  4. Open the Windows Command Prompt. (Start -> Run -> CMD)
  5. Navigate to the directory where you stored bevent.exe, the event file, and the team file.
  6. Type the command: bevent -y 2007 -f 0-96 dodgers_rockies040907.evn (or the name of your event file).  “-y 2007” specifies the year of the game.  If you are generating game info for a game from 1960, make sure you use -y 1960. “-f 0-96” specifies which fields I want bevent to return.  The default is 0-6, 8-9, 12-13, 16-17, 26-40, 43-45 ,51, 58-61.  0-96 means all fields.
  7. If you want to output the game info to a text file (I’d recommend saving as a .csv file so it opens nicely in spreadsheet software), use the command bevent -y 2007 -f 0-96 dodgers_rockies040907.evn > dodgers_rockies_040907_gameinfo.csv.

bevent_screenshot

Here is the output from bevent.exe.

The output is a comma-delimited file that contains the following fields:

0    game id
1    visiting team
2    inning
3    batting team
4    outs
5    balls
6    strikes
7    pitch sequence
8    vis score
9    home score
10   batter
11   batter hand
12   res batter
13   res batter hand
14   pitcher
15   pitcher hand
16   res pitcher
17   res pitcher hand
18   catcher
19   first base
20   second base
21   third base
22   shortstop
23   left field
24   center field
25   right field
26   first runner
27   second runner
28   third runner
29   event text
30   leadoff flag
31   pinchhit flag
32   defensive position
33   lineup position
34   event type
35   batter event flag
36   ab flag
37   hit value
38   SH flag
39   SF flag
40   outs on play
41   double play flag
42   triple play flag
43   RBI on play
44   wild pitch flag
45   passed ball flag
46   fielded by
47   batted ball type
48   bunt flag
49   foul flag
50   hit location
51   num errors
52   1st error player
53   1st error type
54   2nd error player
55   2nd error type
56   3rd error player
57   3rd error type
58   batter dest (5 if scores and unearned, 6 if team unearned)
59   runner on 1st dest (5 if scores and unearned, 6 if team unearned)
60   runner on 2nd dest (5 if scores and unearned, 6 if team unearned)
61   runner on 3rd dest (5 if socres and uneanred, 6 if team unearned)
62   play on batter
63   play on runner on 1st
64   play on runner on 2nd
65   play on runner on 3rd
66   SB for runner on 1st flag
67   SB for runner on 2nd flag
68   SB for runner on 3rd flag
69   CS for runner on 1st flag
70   CS for runner on 2nd flag
71   CS for runner on 3rd flag
72   PO for runner on 1st flag
73   PO for runner on 2nd flag
74   PO for runner on 3rd flag
75   Responsible pitcher for runner on 1st
76   Responsible pitcher for runner on 2nd
77   Responsible pitcher for runner on 3rd
78   New Game Flag
79   End Game Flag
80   Pinch-runner on 1st
81   Pinch-runner on 2nd
82   Pinch-runner on 3rd
83   Runner removed for pinch-runner on 1st
84   Runner removed for pinch-runner on 2nd
85   Runner removed for pinch-runner on 3rd
86   Batter removed for pinch-hitter
87   Position of batter removed for pinch-hitter
88   Fielder with First Putout (0 if none)
89   Fielder with Second Putout (0 if none)
90   Fielder with Third Putout (0 if none)
91   Fielder with First Assist (0 if none)
92   Fielder with Second Assist (0 if none)
93   Fielder with Third Assist (0 if none)
94   Fielder with Fourth Assist (0 if none)
95   Fielder with Fifth Assist (0 if none)
96   event num