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: Replacing the values of time indicator in Panel data


From   Roberto Ferrer <[email protected]>
To   Stata Help <[email protected]>
Subject   Re: st: Replacing the values of time indicator in Panel data
Date   Wed, 15 Jan 2014 00:37:58 -0430

Muhammad Ramzan,

Please follow the Statalist policy stated in the Statalist FAQ,
regarding this issue:

6. Private emails to those active on Statalist

... some posters are tempted to reply directly to people who answer
their initial questions. You are asked not to do that. Instead keep
the thread public so that anyone interested can see any further
discussion and so that no particular person is pressured to write
further if they do not wish.

There can be many reasons to email someone directly: most obviously,
if you are a friend or you have a question specifically about a
program someone has written. Nothing below applies to those kinds of
mail.

However, emailing someone on the grounds that they appear active and
knowledgeable about Stata is a tactic with a low probability of
getting precisely what you want and a high probability of wasting the
time of both parties.

http://www.stata.com/support/faqs/resources/statalist-faq/

Thank you.




On Tue, Jan 14, 2014 at 3:51 AM, Muhammad Ramzan <[email protected]> wrote:
> Assalam-o-Alaikum
>
> Hi, Everyone I am working on Panel data
>
>
> I have collpased the panel data with the following command
>
> bysort country: egen dum = seq(), block(3)
> bysort country dum: gen year2 = year[1]
>
> collapse gdp , by(country year2)
> xtset country year2
>
> I got the following results
> country year2 gdp
> 1 1970 23.5729
> 1 1973 23.53363
> 1 1976 23.63178
> 1 1979 23.75091
> 1 1982 23.84508
> 1 1985 23.96356
> 1 1988 24.05965
> 1 1991 24.18725
> 1 1994 24.32061
> 1 1997 24.46905
> 1 2000 24.62414
> 1 2003 24.78113
> 1 2006 24.96571
> 2 1970
> 2 1973
> 2 1976
> 2 1979 18.56156
> 2 1982 18.71199
> 2 1985 18.93953
> 2 1988 19.2974
> 2 1991 19.4475
> 2 1994 19.56893
> 2 1997 19.73937
> 2 2000 19.94768
> 2 2003 20.17978
> 2 2006 20.43815
> 4 1970 25.49603
> 4 1973 25.56743
> 4 1976 25.71135
> 4 1979 25.78085
> 4 1982 25.93498
> 4 1985 26.07849
> 4 1988 26.26837
> 4 1991 26.38519
> 4 1994 26.57137
> 4 1997 26.74783
> 4 2000 26.90112
> 4 2003 27.10593
> 4 2006 27.36182
>
> I want to change the values of year2 variable into 1 2 3 4 5 6 7 8 so on
>
>
> like
>
> country year2 gdp year
> 1 1970 23.57 1
> 1 1973 23.53 2
> 1 1976 23.63 3
> 1 1979 23.75 4
> 1 1982 23.85 5
> 1 1985 23.96 6
> 1 1988 24.06 7
> 1 1991 24.19 8
> 1 1994 24.32 9
> 1 1997 24.47 10
> 1 2000 24.62 11
> 1 2003 24.78 12
> 1 2006 24.97 13
> 2 1970 1
> 2 1973 2
> 2 1976 3
> 2 1979 18.56 4
> 2 1982 18.71 5
> 2 1985 18.94 6
> 2 1988 19.30 7
> 2 1991 19.45 8
> 2 1994 19.57 9
> 2 1997 19.74 10
> 2 2000 19.95 11
> 2 2003 20.18 12
> 2 2006 20.44 13
> 4 1970 25.50 1
> 4 1973 25.57 2
> 4 1976 25.71 3
> 4 1979 25.78 4
> 4 1982 25.93 5
> 4 1985 26.08 6
> 4 1988 26.27 7
> 4 1991 26.39 8
> 4 1994 26.57 9
> 4 1997 26.75 10
> 4 2000 26.90 11
> 4 2003 27.11 12
> 4 2006 27.36 13
> Regards
>
> Muhammad Ramzan
> *
> *   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