Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Questions about monmissing data in data cleaning

    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!

    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
    ------------------ copy up to and including the previous line ------------------



  • #2
    Can anyone give some suggestions? Thank you!

    Comment


    • #3
      It would probably help if you enumerated all of the possibilities and what you wanted with each, for example, if one (or two) of the nonmissing status values is 1 and another one (or two) is 3 and they have different income minima, or if there are two (or three) status values of 2 and different income values for each.

      Or are these constitutively impossible?

      Comment

      Working...
      X