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: Creating a new variable via another variable name based on a condition


From   Indu Khurana <[email protected]>
To   [email protected]
Subject   st: Creating a new variable via another variable name based on a condition
Date   Thu, 8 Jul 2010 15:25:42 -0400

Hello,

Creating a new variable via another variable name based on a condition

Using stata 8.0. I am trying to create a logical condition which would
copy the name of the variable if satisfied.

Here is what I have:

Aim is to identify the main owner. I have generated one variable Main Owner
I assign value to this variable using maximum no. of hours worked.

I have information on
1. Total 10 owners. Sometimes there may be only 1 or 2 owners.
2. Hours - Number of hours worked per week.
3. Equity - Equity ownership by each worker.
I have data for 5 years. There are approximately 5000 firms.

There are 2 issues:
1. Lets say there are 2 owners (1 and 2) . Owner1 works for 3 hours
and Owner2 works for 2 hours, then I want the variable main owner to
take the value 1. How can I post the name of the variable and not the
value?
2. Now if the hours worked for the owners are the same I use Equity
ownership as the variable to resolve the tie. In that case owner with
maximum equity ownership becomes the main owner. How to create a loop for this?

1st year data


Firms Hrs owner1 Hrs owner2  Hrs owner3  main owner
1             3                2               0                  1
2              2               3              6                   3
3              3               8               .                   2
4              2                .              2         tie - go to equity
.
.
.
5000

Firms Equity ownr1  Equity ownr2  Equity owner3  main ownr
1                50                25                      25         1
2                25                50                      25         3
3                75                25                       .          2
4                80                 .                       20         1
.
.
.
5000


Thanks!!

-- 
Indu Khurana

Department of Economics, DM-308A
Florida International University
Miami, FL 33199
Web: http://www.fiu.edu/~ikhurana
*
*   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