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: ploting the time series of a variable when specific conditions are satisfied


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: ploting the time series of a variable when specific conditions are satisfied
Date   Tue, 5 Feb 2013 17:09:08 +0000

Your problems mostly come towards the end.

1. As these are panel data, -tsset- must specify a panel too.

2. You have said that these are daily data presented as DMY, but they
look like monthly data in disguise.

3. Assigning a monthly format to daily data will not change it to
monthly data, as I often point out on this list. See e.g. the thread
starting at
http://www.stata.com/statalist/archive/2013-01/msg01346.html

Nick

On Tue, Feb 5, 2013 at 4:58 PM, Tzaloupas Dimitrov
<[email protected]> wrote:

>   I have an excel file which I import into Stata. The files contains the following information
>
>
>   country         Overall     specific                Dates          inflation
>     UK               0           0                 01/01/2001        2.05
>     UK               0           0                 01/02/2001         1.52
>     UK               0           0                  01/03/2001         6.6
>  UK               0           0                01/04/2001         8.5
>  UK               0           0               01/05/2001          6.6
>  UK               RR          kk1                01/01/2001        6.9
>     UK               RR          kk1               01/02/2001         0.5
>     UK               RR          kk2               01/03/2001         .
>  UK               RR           kk2             01/04/2001         3.6
>  UK               RR            kk2           01/05/2001         8
>  US                0              0          01/01/2001         7.69
>     US                0              0          01/02/2001         .
>     US                0              0           01/03/2001         4.558
>  US                0              0          01/04/2001         4.69
>  US                0              0          01/05/2001         8.56
>  US                RR             kk1         01/01/2001         7.58
>     US                RR              kk1       01/02/2001         8.69
>     US                RR              kk2       01/03/2001          8.56
>  US                RR              kk2      01/04/2001         0.5
>  US                RR              kk2      01/05/2001         2.258
>
>
>   In the above example I have the evolution of inflation (last column) for 2 countries (UK and US). The dots in the last column mean "NaN"
>
>   I want to plot the evolution of the inflation for each country when this condition is satisfied: Overall==RR & Specific==kk2
>
>   So, I am interested in this part
>
>     UK               RR          kk2               01/03/2001         .
>  UK               RR           kk2             01/04/2001         3.6
>  UK               RR            kk2           01/05/2001         8
>  US                RR              kk2       01/03/2001          8.56
>  US                RR              kk2      01/04/2001         0.5
>  US                RR              kk2      01/05/2001         2.258
>
>  I have been trying some codes but   I am stuck
>
>  For example
>
>
>  gen dummy1 = overall == "RR"
> gen dummy2 = specific == "kk2"
> gen dummy3=1  if dummy1==1 & dummy2==1
> gen edate1 = date(Dates, "DMY")
> format edate1  %tm
> tsset   edate1
>  but I get this error message
>
>  repeated time values in sample
> r(451);
>
>
>   My real matrix is 40000 by 25 as I have many different countries and longer times series of monhtly data.
>
>
>   I use the 64 bit version of Stata 11.
*
*   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