Statalist


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

st: AW: RE: AW: Converting date strings into dates


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: AW: RE: AW: Converting date strings into dates
Date   Mon, 15 Feb 2010 16:49:42 +0100

<> 

" Instead of monthly, I had put date; and that gave me huge numbers"


Been there myself. Not all is lost, though, even in this case. See - help
dates_and_times, mark(converting)-:


*************
clear*

inp str10 stringdate
1999Jan
1999Feb
end

gen double date=date(stringdate , "YM") 
gen double month=mofd(date)
format month %tmMonth_CCYY 
l stringdate month, noo
*************



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von DE SOUZA Eric
Gesendet: Montag, 15. Februar 2010 16:42
An: 'statalist@hsphsun2.harvard.edu'
Betreff: st: RE: AW: Converting date strings into dates

Thanks, Martin.
Instead of monthly, I had put date; and that gave me huge numbers

Eric 


Eric de Souza
College of Europe
Dyver 11
BE-8000 Brugge (Bruges)
Belgium

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Martin Weiss
Sent: 15 February 2010 16:17
To: statalist@hsphsun2.harvard.edu
Subject: st: AW: Converting date strings into dates


<> 



*************
clear*

input  str10 stringdate
1999Jan
1999Feb
end

gen double date=monthly(stringdate , "YM") format date %tmMonth_CCYY l
*************



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von DE SOUZA Eric
Gesendet: Montag, 15. Februar 2010 15:47
An: Statalist
Betreff: st: Converting date strings into dates

I have never quite mastered the technique of converting date strings into
dates.
In this case, I have a string variable of the form: 1999Jan 1999Feb and so
on, and wish to convert it into a date Thanks for any help.

Eric

Eric de Souza
College of Europe
Dyver 11
BE-8000 Brugge (Bruges)
Belgium



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


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