Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.

# st: Calculating days between starts in MLB.

 From Nicholas Miceli To statalist@hsphsun2.harvard.edu Subject st: Calculating days between starts in MLB. Date Thu, 4 Apr 2013 10:35:32 -0500

```Thank you for the information. I had no idea of how to do this in Stata.

Greatly appreciated.

Regards,

Nick MIceli

---------- Forwarded message ----------
Re: st: Calculating days between starts in MLB.
------------------------------

Date: Wed, 3 Apr 2013 08:23:23 +0100
From: Nick Cox <njcoxstata@gmail.com>
Subject: Re: st: Calculating days between starts in MLB.

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
njcoxstata@gmail.com

On 3 April 2013 01:43, N. S. Miceli, Ph.D. <micelin01@gmail.com> 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/

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