Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Date formatting question


From   "Friedrich Huebler" <[email protected]>
To   [email protected]
Subject   Re: st: Date formatting question
Date   Mon, 28 Jan 2008 19:43:36 -0500

Josie,

Your original variable is called month, so use this command instead:

. gen date = monthly(month, "Ym")

Friedrich

On Jan 28, 2008 7:40 PM, Friedrich Huebler <[email protected]> wrote:
> Josie,
>
> Your dates are in %tm format. Read [D] dates and times, especially the
> section on string-to-numeric translation functions.
>
> . gen month = monthly(date, "Ym")
>
> Friedrich
>
>
> On Jan 28, 2008 5:29 PM, Josiane Georges <[email protected]> wrote:
> > I have a variable called month that is a string in "YYYY"m"M" format
> > (eg. 2004m1 is January 2004). What code can I use to convert this
> > variable into a Stata-readable month variable?
> >
> > Josiane "Josie" Georges
> > Analyst, Liaison to the Division of Mental Hygiene
> > Policy & Planning
> > DOHMH
> > Tel: 212-788-5342
> > Fax: 212-788-5353
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index