Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | "N. S. Miceli, Ph.D." <micelin01@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | st: Calculating days between starts in MLB. |
Date | Tue, 02 Apr 2013 19:43:29 -0500 |
Hi all,I'm working through Major League Baseball events data from Retrosheet. The data is formatted so that each observation contains the events that occurred on each play.
From that data, I've extracted the ID for each starting pitcher and the date the game was played. The data is formatted so that each of those variables is an observation.
I'd like to be able to calculate the days between each start for each pitcher. Do I need to reshape the data to do that, so that each start is a variable matched to the pitcher ID?
I'm pretty sure that I'm going to have to take each season's data and match merge the dates to the pitcher ID, then calculate the difference between the dates to determine days elapsed.
If anyone knows of a way to do this, keeping the dates in the original observations, that would be great. I would guess that can be done by programming in Stata, which I've never had to do, and haven't learned.
Any suggestions would be appreciated. Regards, Nick Miceli -- ================================================ Nicholas S. Miceli, Ph.D. Associate Professor of Human Resource Management ================================================ Park University School of Business 8700 N. W. River Park Drive Parkville, MO 64152 ================================================ nicholas.miceli@park.edu ================================================ * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/