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]

st: RE: Duplicate observations with equal values (except one value). Add up this value and keep one observation


From   "Howrey, Bret T." <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: RE: Duplicate observations with equal values (except one value). Add up this value and keep one observation
Date   Sun, 19 Jan 2014 15:29:13 +0000

Tried _collapse_  ?

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of miriam geringer
Sent: Sunday, January 19, 2014 8:55 AM
To: [email protected]
Subject: st: Duplicate observations with equal values (except one value). Add up this value and keep one observation

Hey guys,

in my dataset, there are some entries (duplicate entries), which are identical (all variables have identical values), EXCEPT one variable.

There is one variable, which has different values. All other variables have exactly the same variables.

Now, I want to add/sum up these two different values and keep all other (identical) variables the same. After adding up the different values, I want to keep only one observation with the summed up value.

Example:

This is how it looks:
PERMNO      dofd (DAILY_ID)           Price            Shares offered
123456             1                                     5
            8
123456             1                                     5
            6

This is how it should be:
PERMNO       dofd(DAILY_ID)           Price             Shares offered
123456              1                                   5
            14

Somethink like: If all variables are the same except variable "shares offered", sum up this variable and keep one observation.

Can anyone help?

Thanks!
*
*   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/

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