Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: RE: dates in stata


From   Howard Lempel <HLempel@brookings.edu>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: RE: RE: dates in stata
Date   Tue, 31 Mar 2009 17:15:20 -0400

Specifically, Lisa should look at the sections "inputting date and time data" and "string-to-numeric translation functions (under remarks)"

Hope this helps.
Howie

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Newson, Roger B
Sent: Tuesday, March 31, 2009 5:06 PM
To: 'statalist@hsphsun2.harvard.edu'
Subject: st: RE: dates in stata

It appears to me that Ischoele is sorting dates in string format. If Ischoele annts dates to be numeric, and expressed as number of days elapsed since 01 January 1960, then Ischoele should type, in Stata,

whelp dates and times

and this will cause the on line help for date and time functions to appear. These can be used to convert Ischoele's string dates to numbers, which can then be sorted in ascending order of time.

I hope this helps.

Best wishes

Roger


Roger B Newson BSc MSc DPhil
Lecturer in Medical Statistics
Respiratory Epidemiology and Public Health Group
National Heart and Lung Institute
Imperial College London
Royal Brompton Campus
Room 33, Emmanuel Kaye Building
1B Manresa Road
London SW3 6LR
UNITED KINGDOM
Tel: +44 (0)20 7352 8121 ext 3381
Fax: +44 (0)20 7351 8322
Email: r.newson@imperial.ac.uk 
Web page: http://www.imperial.ac.uk/nhli/r.newson/
Departmental Web page:
http://www1.imperial.ac.uk/medicine/about/divisions/nhli/respiration/popgenetics/reph/

Opinions expressed are those of the author, not of the institution.

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of lschoele@rumms.uni-mannheim.de
Sent: 31 March 2009 21:45
To: statalist@hsphsun2.harvard.edu
Subject: st: dates in stata

Hello Statalist,

I am using Stata for event study. I entered all my variables and observations.
Regarding my variable "date" I have a problem. When I use "sort date",  
stata  sorts the date shown above:date
01 April 2002
01 April 2003
01 April 2004
01 April 2005
01 April 2008
01 August 2000
01 August 2001
01 August 2002
01 August 2003
01 August 2005
01 August 2006
01 August 2007
01 August 2008
01 December 2000
01 December 2003
01 December 2004
01 December 2005
01 December 2006
01 February 2000
01 February 2001
01 February 2002
01 February 2005
01 February 2006
01 February 2007
01 February 2008
01 July 2002
01 July 2003
01 July 2004
01 July 2005
01 July 2008
01 June 2000
01 June 2001
01 June 2004
01 June 2005
01 June 2006
01 June 2007
01 March 2000
01 March 2001
01 March 2002
01 March 2004
01 March 2005
01 March 2006
01 March 2007
01 May 2000
01 May 2001

I can tell that stata sorts by the first letter of the month. Do I  
have to use a special format for the date? I also tried the format  
01.04.2002, but that gives me the same sortation shown above.

Can anyone help me?

Best regards
Lisa



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

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

*
*   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   |   What's new   |   Site index