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 at the end of May, and its replacement, statalist.org is already up and running.


[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 <tzaloupas1232@yahoo.gr>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index