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.

Trackback

no comment until now

Add your comment now