Bookmark and Share

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: datevar transformation


From   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
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
[email protected]

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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index