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 on April 23, and its replacement, statalist.org is already up and running.


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

Re: st: How to convert Daily data with gaps to weekly?


From   William Pratt <williamrpratt@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: How to convert Daily data with gaps to weekly?
Date   Tue, 6 Mar 2012 21:10:05 -0600

It depends on what your goal is. You can use tsfill to create weekend
values, though you will have no data for those days. The other method
is to use the group function within the egen command. This will create
a value that you can use to ts or xt set your data, as well as
generation lag variables.

tsfill

egen (new var) = group ( )

On Tue, Mar 6, 2012 at 6:43 PM, Joao Ricardo F. Lima
<jricardofl@gmail.com> wrote:
> Dear Statalisters,
>
> I'm working with a time series of guava price like this:
>
> input str11 date preco_goi
> 7-Oct-2004      9.00
> 10-Oct-2004     8.00
> 12-Oct-2004     8.00
> 14-Oct-2004     7.00
> 17-Oct-2004     6.00
> 19-Oct-2004     6.00
> 21-Oct-2004     7.00
> 24-Oct-2004     7.00
> 26-Oct-2004     8.00
> 28-Oct-2004     9.00
> 31-Oct-2004     9.00
> 2-Nov-2004      9.00
> 4-Nov-2004      10.00
> 9-Nov-2004      10.00
> 11-Nov-2004     10.00
> 14-Nov-2004     10.00
> 16-Nov-2004     9.00
> 18-Nov-2004     8.00
> 21-Nov-2004     8.00
> 23-Nov-2004     7.00
> 25-Nov-2004     7.00
> 28-Nov-2004     7.00
> 30-Nov-2004     7.00
> end
>
> The time series is daily but with gaps. Thus, I can´t use the -dfgls-
> command, for example and others TS commands.
>
> What can I do in this case? Can I convert the daily data with gaps to
> weekly? Is there a better procedure to do the trick?
>
> I would like to receive suggestions.
>
> Thanks a lot!
>
> --
> ---------------------------------------------------------
> João Ricardo F. de Lima
> Pesquisador A - Economia Aplicada
> Embrapa Semiárido
> e-mail: joao.ricardo@cpatsa.embrapa.br
> fone: +55 (87) 3866-3667
> home-page: www.cpatsa.embrapa.br
> ----------------------------------------------------------
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/



-- 
wrpratt@utpa.edu
University of Texas-Pan American
College of Business Administration
Department of Finance and Economics
South Texas Border Health Disparities Center
o - 956.665.7937
f - 956.665.7310

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


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