Announcement

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

  • Dummy variables

    Please I'm very new to using stata, and I want to create dummy variable for values of 0-1 in equal half.
    i.e I have a value that measures probability from 0-1, which I want to code as low and high (0=low, 1=high)

  • #2
    do you mean you want 50% 0's and 50% 1's or do you mean you want to split the data at a probability of .5?

    Comment


    • #3
      Thank you Rich, yea I want to split the data so 0-0.5 could read 0 and values greater than 0.5 will be 1

      Comment


      • #4
        If I understand correctly, you want:

        Code:
        g high= var>=0.5
        lab def high 1 "high" 0 "low"
        lab values high high
        where you replace "var" with the name of your variable.

        Comment


        • #5
          if I read #3 correctly, change Andrew Musau 's command by deleting the equals sign in the generate command (first line) - it is a typo

          Comment


          • #6
            Thank you Andrew and Rich

            Comment

            Working...
            X