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: Average of previous years


From   emanuele mazzini <madsoenistata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Average of previous years
Date   Mon, 11 Apr 2011 13:16:47 +0200

Cool!!
Thank you very much!!!


2011/4/9 Nick Cox <njcoxstata@gmail.com>:
> gen y = (L1.x + L2.x + L3.x + L4.x + L5.x) / 5
>
> !!!
>
> On Sat, Apr 9, 2011 at 5:19 PM, Nick Cox <njcoxstata@gmail.com> wrote:
>> Suppose you have -tsset- your data. Then this is
>>
>> gen y = (L1.x + L2.x + L3.x + L4.x + L5.x)
>>
>> Nick
>>
>> On Sat, Apr 9, 2011 at 4:29 PM, emanuele mazzini
>> <madsoenistata@gmail.com> wrote:
>>>
>>> i do have the following problem in generating a new variable: I need
>>> to generate a variable which takes the value of the average values of
>>> the five preceding years of another variable that I have in my
>>> dataset.
>>> In other words, supposing my new variable is y at time t, I need that
>>> its value is equal to the average of another variable (say x) from t-1
>>> to t-5.
>>>
>>> Since I am just beginning in using Stata anyone knows how can I deal
>>> with this or find any help?
>>
> *
> *   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/
>

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