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: Panel Data 5 Year Average


From   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: Panel Data 5 Year Average
Date   Sat, 11 Jan 2014 11:21:55 +0000

<>

You had an answer to the same question about repeating for several
variables on 8th January.

http://www.stata.com/statalist/archive/2014-01/msg00218.html

See (for example) -help foreach-, the manual entry, and

SJ-2-2  pr0005  . . . . . .  Speaking Stata:  How to face lists with fortitude
        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  N. J. Cox
        Q2/02   SJ 2(2):202--222                                 (no commands)
        demonstrates the usefulness of for, foreach, forvalues, and
        local macros for interactive (non programming) tasks

http://www.stata-journal.com/sjpdf.html?articlenum=pr0005

Nick
[email protected]


On 11 January 2014 07:54, Muhammad Ramzan <[email protected]> wrote:

> Yes this is what i want .
>
> can you please also guide me how can i apply this command on all the
> variables in my data-set.


On 8 January 2014 17:27, Roberto Ferrer <[email protected]> wrote:

>>> Do you want something like:
>>>
>>>
>>>
>>> . bysort country: egen dum = seq(), block(5)
>>>
>>> . bysort country dum: gen year2 = year[1]
>>>
>>> . collapse y5=y l5=l, by(country year2)
>>>
>>> . list, sepby(country)
>>>
>>>      +---------------------------------+
>>>      | country   year2      y5      l5 |
>>>      |---------------------------------|
>>>   1. |       1    1981    22.6    8.92 |
>>>   2. |       1    1986    24.2    9.46 |
>>>   3. |       1    1991    26.6    9.98 |
>>>   4. |       1    1996    28.4   10.48 |
>>>   5. |       1    2001    30.6   10.98 |
>>>      |---------------------------------|
>>>   6. |       2    1980   .2348   .0906 |
>>>   7. |       2    1985   .2408   .0938 |
>>>   8. |       2    1990   .2462   .1076 |
>>>   9. |       2    1995   .2496   .1196 |
>>>  10. |       2    2000   .2536    .129 |
>>>  11. |       2    2005   .1285    .067 |
>>>      +---------------------------------+
*
*   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