Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: datevar transformation


From   Nick Cox <njcoxstata@gmail.com>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   Re: st: datevar transformation
Date   Mon, 24 Jun 2013 23:22:08 +0100

One possibility is to read the documentation.

-help dates and times- is a place to start. It is long but a few
seconds after using operating system search within the window you
would find reference to -quarterly()-.

Consider

. gen qdate = quarterly("2001q1", "YQ")

. l

     +-------+
     | qdate |
     |-------|
  1. |   164 |
     +-------+

. format qdate %tq

. l

     +--------+
     |  qdate |
     |--------|
  1. | 2001q1 |
     +--------+

In your case that might be

gen qdate = quarterly(Quarter, "YM")
format qdate %tq

See also help for -tsset-.

Nick
njcoxstata@gmail.com

Zied OUELHAZI [edited]
>
> I'm working with time series on Stata 12 SE using quarterly data. I'm importing my Excel file which looks like this:
>
> Quarter | Dep_VAR | VAR1 |...  |VAR4
>
> 2000q1
> 2000q2
> 2000q3
> 2000q4
> .
> .
> .
> 2012q1
> 2012q2
> 2012q3
> 2012q4
>
> the datevar 'Quarter' is string and I would like to transform it in order to declare my data as time series. How should I proceed?
*
*   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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index