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: Elapsed Time Paneldata
From
Nick Cox <[email protected]>
To
[email protected]
Subject
Re: st: Elapsed Time Paneldata
Date
Sun, 20 Jan 2013 20:43:23 +0000
For broader treatments Stata Press books on Stata and StataCorp's
NetCourses are all excellent. But there is one resource that you have
already that is typically, so far as I can tell, astonishingly
undervalued.
The earlier chapters of the [U] cover briskly many basic details. The
later chapters are more challenging but cover a mass of important
features clearly and concisely, including -by:-. They also include a
graded introduction to Stata programming.
On Sun, Jan 20, 2013 at 6:39 PM, Nick Cox <[email protected]> wrote:
> My code is just an application of -by:-.
>
> When the data are explicitly -sort-ed in the usual panel order, first
> by identifier and then by -date-, then you can always refer to the
> first -date- of each panel as -date[1]-.
>
> I wrote a tutorial
>
> SJ-2-1 pr0004 . . . . . . . . . . Speaking Stata: How to move step by: step
> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . N. J. Cox
> Q1/02 SJ 2(1):86--102 (no commands)
> explains the use of the by varlist : construct to tackle
> a variety of problems with group structure, ranging from
> simple calculations for each of several groups to more
> advanced manipulations that use the built-in _n and _N
>
> a .pdf of which is accessible at
>
> http://www.stata-journal.com/sjpdf.html?articlenum=pr0004
>
> Despite its title, this FAQ is also pertinent
>
> FAQ . . . . . . . . . . . . . . . . . . . . . . . Generating the last date
> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . N. J. Cox
> 4/05 How can I generate a variable containing the last of
> several dates?
> http://www.stata.com/support/faqs/data-management/generating-last-date/
>
> Knowing that -by:- is the answer depends on knowing that command well, but
>
> . search date, faq
>
> would have pointed to the FAQ and in turn to a -by:- approach.
>
> Nick
>
> On Sun, Jan 20, 2013 at 5:41 PM, Steven Archambault
> <[email protected]> wrote:
>> Thanks so much. I spent hours trying to figure this out. I need to
>> improve my programming skills. If you can recommend a Stata training
>> session, or other resources, please do.
>>
>>
>> On Sun, Jan 20, 2013 at 4:45 AM, Nick Cox <[email protected]> wrote:
>>> bysort newid (date) : gen elapsed = date - date[1]
*
* 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/