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: Re: st: Two identical observations except one variable = sum up this variable and drop one observation
From
Red Owl <[email protected]>
To
<[email protected]>
Subject
RE: Re: st: Two identical observations except one variable = sum up this variable and drop one observation
Date
Sun, 19 Jan 2014 10:13:58 -0500
Miriam,
Try this:
egen newshares = total(Shares), by(PERMNO date Price)
bysort PERMNO date Price newshares: keep if _n==_N
drop Shares
Red Owl
[email protected]
> miriam geringer <[email protected]> wrote:
>
> This is how it looks:
> PERMNO date Price Shares offered
> 123456 1 5 8
> 123456 1 5 6
>
> This is how it should look like:
> PERMNO date Price Shares offered
> 123456 1 5 14
*
* 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/