Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: st: converting date format
From
"Bosch, Darrell" <[email protected]>
To
<[email protected]>
Subject
RE: st: converting date format
Date
Tue, 23 Jul 2013 08:44:12 -0400
Thank you!
Darrell Bosch
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Dimitriy V. Masterov
Sent: Monday, July 22, 2013 2:39 PM
To: Statalist
Subject: Re: st: converting date format
If your date is stored as a string, you will need to convert it to Stata date format first:
. gen date2=date(date,"MDY")
. format date2 %td
Then convert it to year-quarter like this:
. gen yq = qofd(date2)
. format yq %tq
On Mon, Jul 22, 2013 at 11:29 AM, Bosch, Darrell <[email protected]> wrote:
>
>
> I have a dataset with data entered by quarter from 1947 to 2012. The following date variable indicates the dates of each observation (month/day/year).
> 01/01/1947
> 04/01/1947
> 07/01/1947
> ...
> ...
> 01/01/2012
> 04/01/2012
> 07/01/2012
> 10/01/2012
>
> I would like to convert the dates to quarters as follows:
> 1947q1
> 1947q2
> 1947q3
> Etc.
>
> Any suggestions on how to do this would be appreciated.
>
> Darrell Bosch
>
>
>
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/faqs/resources/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/faqs/resources/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/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/