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: Display one observation


From   David Bell <[email protected]>
To   <[email protected]>
Subject   Re: st: Display one observation
Date   Wed, 15 Sep 2010 14:16:48 -0400

--
Or if you want the last and it is not cumulative..
If you just want to know the last value per year without adding anything to your dataset, then
-preserve-, -drop- missings, and -collapse (last)-

Dave
====================================
David C. Bell
Professor of Sociology
Indiana University Purdue University Indianapolis (IUPUI)
(317) 278-1336
====================================




On Sep 15, 2010, at 2:02 PM, Dimitriy V. Masterov wrote:

> If your sums is monotonic, as it appears to be, I think this should work:
> 
> bys year: egen maxcs=max(cusum)
> 
> I get this:
> 
> year	cusum	maxcs
> 2000	2	8
> 2000	4	8
> 2000	6	8
> 2000	8	8
> 2000		8
> 2000		8
> 2001	5	12
> 2001		12
> 2001	6	12
> 2001	12	12
> 
> 
> HTH,
> DVM
> *
> *   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/


*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index