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   Zied OUELHAZI <[email protected]>
To   [email protected]
Subject   Re: st: datevar transformation
Date   Tue, 25 Jun 2013 00:06:53 +0100 (GMT+01:00)

Thanks a lot it worked

Thanks
 

----- Mail original -----
De: "Nick Cox" <[email protected]>
À: [email protected]
Envoyé: Lundi 24 Juin 2013 23:22:08
Objet: Re: st: datevar transformation

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/

*
*   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