Dear Stata users,
I‘ve got a question regarding the formatting of a date variable in Stata.
I imported an Excel sheet with a date variable into Stata using the following code to import and format the date variable correctly:
gen date_birth =date(birth,"YMD")
format %td date_birth
In Stata the variable date_birth is now correctly displayed as
1 18oct2012 (corresponds 19284)
2 20oct2001 (corresponds 15268)
3 16may1994 (corresponds 12554)
I now would like to have these dates displayed without the day included as follwos:
1 Oct 2012
2 Oct 2001
3 May 1994
Therefore I run the following command for the variable: format %tmMon_CCYY date_birth
But Stata’s output is now:
1 January 3567
2 May 3232
3 March 3006
Is it not possible to just display the date in another format? Or do I need to reimport the dates to adjust the display settings?
I'm using Stata 12.0
Many thanks for your help!
Isabel
I‘ve got a question regarding the formatting of a date variable in Stata.
I imported an Excel sheet with a date variable into Stata using the following code to import and format the date variable correctly:
gen date_birth =date(birth,"YMD")
format %td date_birth
In Stata the variable date_birth is now correctly displayed as
1 18oct2012 (corresponds 19284)
2 20oct2001 (corresponds 15268)
3 16may1994 (corresponds 12554)
I now would like to have these dates displayed without the day included as follwos:
1 Oct 2012
2 Oct 2001
3 May 1994
Therefore I run the following command for the variable: format %tmMon_CCYY date_birth
But Stata’s output is now:
1 January 3567
2 May 3232
3 March 3006
Is it not possible to just display the date in another format? Or do I need to reimport the dates to adjust the display settings?
I'm using Stata 12.0
Many thanks for your help!
Isabel
Comment