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   Muhammad Ramzan <[email protected]>
To   [email protected]
Subject   Re: st: Replacing the values of time indicator in Panel data
Date   Tue, 14 Jan 2014 14:53:47 +0500

How ?

I donot got your point?

On 14 January 2014 14:38, Nick Cox <[email protected]> wrote:
> You can get there directly by
>
> bysort country: egen year2 = seq(), block(3)
> collapse gdp , by(country year2)
> xtset country year2
>
> Look at the documentation for -egen- to see what -seq()- does.
>
> Nick
> [email protected]
>
> On 14 January 2014 08:21, Muhammad Ramzan <[email protected]> wrote:
>
>> I am working on Panel data
>>
>>
>> I have collapsed 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
> *
> *   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/



-- 
Assalam-o-Alaikum







Muhammad Ramzan
Lecturer (Economics)
Pakistan Institute of Development Economics
Islamabad
*
*   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