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/