Bookmark and Share

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.


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

Re: st: Tabulation of a variable against itself lagged


From   Robson Glasscock <glasscockrc@vcu.edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Tabulation of a variable against itself lagged
Date   Sun, 18 Sep 2011 08:59:36 -0400

Also see -help xtset- for panel data.

Even after properly declaring the time element of the data, I received
an error when trying to use the lag operator within the tabulate
command. I ended up generating a new variable, regime_2, equal to the
lag of regime and then tabulating regime and regime_2.

best,
Robson Glasscock

On Sun, Sep 18, 2011 at 7:30 AM, Partho Sarkar
<partho.ss+lists@gmail.com> wrote:
> You need to use -tsset- to declare your data as a time series, or in
> this case, a panel data, before you can use time series operators.
> See -help tsset-
>
> On Sun, Sep 18, 2011 at 4:18 PM, Iulian Ihnatov <iulian.ihnatov@uaic.ro> wrote:
>> Thank you, Robson!
>> The solution seems obvious, but I think my data may have an unappropriate
>> structure.
>> Let me explain. I had csv file which I imported in Stata, with the following
>> structure:
>>
>> countryname
>> indicatorname
>> y1999
>> y2000
>> ...........
>> y2010
>>
>> I imported and structured the data to match other series that I use in my
>> research, as follows:
>> * import data
>> insheet using regimuri.csv, delimiter(";")
>> * structure data
>> gen id1=_n
>> reshape long y, i(id1) j(year)
>> encode indicatorname, gen(varnum)
>> drop indicatorname
>> egen id2=group(countryname year)
>> reshape wide y, i(id2) j(varnum)
>> rename y1 regime
>>
>> Now my data looks like:
>> id1
>> id2
>> year
>> countryname
>> regime
>>
>> If I use time series operators I get errors:
>> E.g: -tabulate regime L.regime- "time-series operators not allowed"
>>        -gen regime1=L.regime- "time variable not set"
>>
>> Have I been wrong in transforming the data? Any help would be highly
>> appreciated.
>>
>> Yours sincerely,
>> Iulian Ihnatov
>>
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/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/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index