Hello everone!
I have some trouble doing data cleaning. As you can see, I want to generate two new variables (status/income)based on the variables above. The rules are following:
1)If all the nonmissing variable about status(i.e. status1 2 3)=1 then the final statuts=1(see at pid1). And the income=min(non missing (income1 income 2 income3))
2)If all the nonmissing variable about status(i.e. status1 2 3)=3 then the final statuts=3 (see at pid2). And the income=min(non missing (income1 income 2 income3))
3)If there is anycount=2 in status 1 2 and 3, no matter other status is 1 or 3, the final status=2 and the final income=the income of that status=2(see at pid3)
Becasue there are some missing at status1 2 3 and income... I actually have no ideea how to achieve it.
Can anyone give some suggestions?
Thank you!
------------------ copy up to and including the previous line ------------------
I have some trouble doing data cleaning. As you can see, I want to generate two new variables (status/income)based on the variables above. The rules are following:
1)If all the nonmissing variable about status(i.e. status1 2 3)=1 then the final statuts=1(see at pid1). And the income=min(non missing (income1 income 2 income3))
2)If all the nonmissing variable about status(i.e. status1 2 3)=3 then the final statuts=3 (see at pid2). And the income=min(non missing (income1 income 2 income3))
3)If there is anycount=2 in status 1 2 and 3, no matter other status is 1 or 3, the final status=2 and the final income=the income of that status=2(see at pid3)
Becasue there are some missing at status1 2 3 and income... I actually have no ideea how to achieve it.
Can anyone give some suggestions?
Thank you!
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float(pid status1 income1 status2 income2 status3 income3) byte status float income 1 1 500 1 400 . . 1 400 2 3 20 3 100 3 500 3 20 3 2 5000 1 500 . . 2 5000 end label values status1 status label values status2 status label values status3 status label values status status label def status 1 "before", modify label def status 2 "across", modify label def status 3 "after", modify

Comment