Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: 'sophisticated' subscripting


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: 'sophisticated' subscripting
Date   Sun, 27 May 2007 18:38:09 +0100

Precisely this problem was discussed just a few days ago. See
this post from 18 May: 

http://www.hsph.harvard.edu/cgi-bin/lwgate/STATALIST/archives/statalist.0705/Author/article-645.html

Here it is again:  

gen pop1700 = pop if year == 1700
bysort city (pop1700) : replace pop1700 = pop1700[1] 

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

Davide Cantoni
 
> I have an (unbalanced) panel of cities, with their respective
> populations over a series of years. Now I want to generate a new
> variable that gives me, for each city, the population of that city in
> 1700. Due to the unbalanced nature of the panel, it is NOT the case
> that 1700 is the first (or nth) observation within group, so that
> subscripting within groups is not going to help me in this case. Any
> suggestions?
> 
> Thanks,
> 
> Davide
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
> 

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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   |   What's new   |   Site index