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]

st: getting Stata to read a bizarre sequence of dates


From   stef salvez <loggyedy@googlemail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: getting Stata to read a bizarre sequence of dates
Date   Wed, 13 Jun 2012 00:37:25 +0100

Dear all,

I have the following panel data set

 clear all
cd d:\
input str8  (dates1)	        id	
 "23/11/08"         1
"28/12/08"          1
 "25/01/09"        1
 "22/02/09"         1
"29/03/09"         1
 "26/04/09"        1
 "24/05/09"        1
 "23/11/08"         2
"28/12/08"          2
 "25/01/09"        2
 "22/02/09"        2
"29/03/09"         2
 "26/04/09"        2
 "24/05/09"        2

end

the difference (in days)  between successive dates is 35 28 28 35 28 28

The problem is that I do not know how to convert these string dates
into numeric variables given the fact that I have 2 jumps  (35 days)
 if i issue the commands

gen edate1 = date(dates1, "DM20Y")
gen edate2 = floor(edate1/28)
tsset id edate2

I get the following error message

panel variable:  id (strongly balanced)
        time variable:  edate2, 637 to 644, but with gaps
                delta:  1 unit

Is there any code that could fix that so as to get Stata to "read"
that "bizarre"sequence of dates?


Thanks in advance
*
*   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