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: RE: statalist-digest V4 #4311


From   Mark McCann <mark.mccann@qub.ac.uk>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: RE: statalist-digest V4 #4311
Date   Fri, 21 Oct 2011 14:31:11 +0100

Hello all,

                I'm at a loss as to what's happening here. I have checked the help files and statalist, but I just can't make sense of this. My time variable appears to be reading seconds incorrectly, this happened before I added a dummy ":00" seconds onto the string variable, and after (as below). Any ideas on what is happening? I'm using Stata 11 on Windows


gen space=" "
gen seconds=":00"
egen time1=concat(date space time seconds)
gen time2=clock(time1,"DMYhms")
format time2 %tc


Here are the results for the first observation, I've fixed these to stop formatting problems

Date 01/05/2011   
Time 00:01       
Seconds :00   
Time1 [The used variable] 01/05/2011 00:01:00   


Time2 [The final variable] 01may2011 00:00:28 


Similar errors occur throughout, in some cases rounding up or down would give the wrong result so I can't use a quick fix and ignore the problem!


Any help much appreciated.

                Kind regards,
                                Mark

Research Statistician
Improving Children's Lives 
Institute of Child Care Research
Queen's University Belfast
6 College Park
Belfast BT7 1LP

Tel: +44(0)28 9097 3163

Improvingchildrenslives.org


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