Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | miriam geringer <miriam.geringer@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | st: Duplicate observations with equal values (except one value). Add up this value and keep one observation |
Date | Sun, 19 Jan 2014 15:55:12 +0100 |
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/