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
Trackback

8 comments until now

  1. Richard Thomas

    Alternatives to box, bevent, and bgame can be found at Project Chadwick at http://chadwick.sourceforge.net/index.html. They can generate the same as above plus more, including xml output. There are also other utilities included.

  2. Thanks for the info.

    I knew these files were available, but I’ve never personally used them.

    I’ll make a note to try them out, and then I’ll add a post to the site.

    Thanks again!
    Ben

  3. How would I go about using cwevent to output ALL events for a certain year? (Trying to update my db with 2010 statistics)

    Thanks

  4. Make sure that you have all of your event files in the same directory. Use the same command except type the filename of each team’s event file, separated by a space.

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

  5. Wow, thank you for your timely response. That worked like a charm. I appreciate it.

  6. I’m using a Mac to run the commands using chadwick and I keep getting the error message that the team file is not found although I am sure it is in the same directory. Is there an additional command needed when setup for Mac?

  7. I just tried cwevent, and it worked fine.

    cwevent -y 2002 -f 0-96 2002OAK.EVA > Testing.csv;

  8. cwgame worked too.

    cwgame -y 2002 2002OAK.EVA > Testing.csv;

Add your comment now