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 at the end of May, and its replacement, statalist.org is already up and running.


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

st: RE: Ask how copy values


From   Nick Cox <n.j.cox@durham.ac.uk>
To   "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Ask how copy values
Date   Tue, 18 Oct 2011 15:16:23 +0100

At a guess, you want something like 

bysort country (year) : gen gdp50 = gdp[1] 

where I assume that the first year for every panel is 1950. For more complicated variations on this problem, see

SJ-11-2 dm0055  . . . . . . . . . . . . . .  Speaking Stata: Compared with ...
        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  N. J. Cox
        Q2/11   SJ 11(2):305--314                                (no commands)
        reviews techniques for relating values to values in other
        observations

Nick 
n.j.cox@durham.ac.uk 

Adiwan Fahlan

I want to generate an initial gdp value such as below:

Country year   gdp50
1       1950   200
1       1960   200
1       1970   200
2       1950   300
2       1960   300
2       1970   300
.
.
.
20   1970       400

Can anyone help me with the code that generate the initial gdp for all country and year?


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