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]

st: ploting the time series of a variable when specific conditions are satisfied


From   Tzaloupas Dimitrov <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: ploting the time series of a variable when specific conditions are satisfied
Date   Tue, 5 Feb 2013 16:58:37 +0000 (GMT)

  Dear all, 
  
  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.
  
  Any help is greatly apperciated
  
  Regards,
  tzaloupas

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