Re: st: RE: AW: how to reconstruct a minimum acceptable income from a set of binary variables?

 From Ekaterina Hertog To statalist@hsphsun2.harvard.edu Subject Re: st: RE: AW: how to reconstruct a minimum acceptable income from a set of binary variables? Date Mon, 02 Mar 2009 18:11:47 +0000

```Thank you very much for all the suggestions!
Sincerely yours,
Ekaterina

Nick Cox wrote:
```
To modify my earlier suggestion, your code could be gen min = 7000 foreach v of numlist 6000 5000(500)1000 0 { replace min = `v' if mindesinc_`v' == 1 }
```
```
replace min = 0 if no_desired_income == 1 Nick n.j.cox@durham.ac.uk
```Ekaterina Hertog

```
The real structure of my data is as I stated originally, rather than as Martin described it:
```e.g.
input id mindesinc_500_999 mindesinc_1000_1499  mindesinc_1500_1999
101 1 1 1 1
102 0 1 1 1
103 0 0 1 1
104 0 0 1 1
105 0 1 1 1

```
Basically once the person finds a certain income acceptable he or she finds every income above acceptable too and puts 1s, rather than 0s. At the moment I used one of the earlier advices I got with a bit of a modification
```gen mindesinc=0
replace mindesinc=7000 if  desired_income_above_7000==1
replace mindesinc=6000 if  desired_income_6000_6999==1
replace mindesinc=5000 if  desired_income_5000_5999==1
replace mindesinc=4500 if  desired_income_4500_4999==1
replace mindesinc=4000 if  desired_income_4000_4499==1
replace mindesinc=3500 if  desired_income_3500_3999==1
replace mindesinc=3000 if   desired_income_3000_3499==1
replace mindesinc=2500 if   desired_income_2500_2999==1
replace mindesinc=2000 if  desired_income_2000_2499==1
replace mindesinc=1500 if  desired_income_1500_1999==1
replace mindesinc=1000 if  desired_income_1000_1499==1
replace mindesinc=0 if  desired_income_0_999==1 |  no_desired_income==1

```
I know it is not very elegant, but I thought this would pick up the lowest acceptable income.
```
```
```Nick Cox wrote:
```
A variation on the same idea: gen min = 500
```foreach v in 1000 1500 2000 {     replace min = `v' if mindesinc_`v'
```
```
```
```== 1 }

To be careful, check
egen row = rowtotal(mindesinc*) assert row == 1
Nick n.j.cox@durham.ac.uk
```
```
```
```Ekaterina Hertog
I am dealing with a dataset from a private company and so my data
```
```often
```
```comes in rather strange format and I now came against the following
problem:
```
```income.
```
```It looks as follows:

Individ nmb | Min desired income 500 - 999 | 1000 - 1499 |  1500 -
```
```2000
```
```|
```
101 | 0 | 0 | 1 | 102 | 0 | 1 | 1 | 103 | 0 | 0 | 1 | 104 | 1 | 1 | 1 | 105 | 0 | 1 | 1 |
```
Is there a way to automatically recode these binary minimum desired
```
```
```
```income variables into a numerical variable which would state the
```
```minimum
```
```acceptable figure for each individual?
```
That is some routine which would check "Min desired income 500 - 999" and if it equals 1 then would input 500 for the individual in question into a newly constructed variable "Minimum acceptable income" and
```move
```
on to the next person and if it equals 0 would look at the value of "1000 - 1499" variable and if it equals 1 would input 1000 for that person and move on to the next person and if it is 0 would look at
```"1500
```
```- 2000" variable?
```
```
*
*   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/
```
```

--
Ekaterina Hertog (née Korobtseva)
Career Development Fellow
Department of Sociology and Nissan Institute of Japanese Studies
University of Oxford

Oxford
OX2 6NA
United Kingdom

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