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: merging same variables within a dataset


From   Dmitriy Glumov <[email protected]>
To   [email protected]
Subject   st: merging same variables within a dataset
Date   Fri, 12 Aug 2011 14:33:38 -0400

Hello,

 I have just started using Stata and have ran into a problem. I would
like Stata to identify observations within a dataset that have the
same name, and add their respective values. To give an example, the
sample of the dataset looks something like this:

Name Position Salary Bonus Compensation Company
John  Manager    10       10         20                   a
Jack  Manager    20       20         30                   a
Brian  Director    10       10         40                   c
Amy  Manager    20       20         30                   d
John  Director     10       10         20                   a
Amy  Director     20       30         20                   d


And I want it to end up looking like this:

Name   Position              Salary Bonus Compensation Company

John  Manager/Director       20       20         40                   a
Jack  Manager                   20       20         30                   a
Brian  Director                   10       10         40                    c
Amy  Manager/Director      40       50         50                    d

In short, I would like Stata to identify same names and then add
salary, bonus, and compensation together, while also keeping the
company name and position. It is best if the company displays only one
label during the merge ("a" instead of "aa" or "a-a", etc) but, as far
as position, either merging or appending or just displaying either
name would be fine (so ManagerDirector or just one of the names would
also work), I just don't want it to create an error during the
transformation process.

Thank you for your consideration and any help with this would be
greatly appreciated.

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