Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Calculating days between starts in MLB.


From   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: Calculating days between starts in MLB.
Date   Wed, 3 Apr 2013 08:23:23 +0100

This sounds like a question from last week:

http://www.stata.com/statalist/archive/2013-03/msg01253.html

As that question showed, difference between successive dates is one
line in Stata, with no programming needed.

In Stata, a variable is an entire column of data and an observation an
entire row.

Nick
[email protected]

On 3 April 2013 01:43, N. S. Miceli, Ph.D. <[email protected]> wrote:

> 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.
*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index