Announcement

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

  • Creating an Abortion scale

    Hello Everyone,


    I am trying to create a 7-point scale for attitudes towards abortion for every decade using GSS from 1980 to 2021. So, the command I used for the 1980s is

    gen scale_1980s= (abany*2 + abdefect*.3 + abnomore*1.5 + abhlth*.1 + abpoor*1.5 + abrape*.3 + absingle*1.3) if year==1980 | year==1982 | year==1983| year==1984 | year==1985 | year==1987 | year==1988 | year==1989

    I have given values to each variable based on response frequency. If a variable has a higher response, it has lower values. For example, 81.94 percent supported abortion for rape (abrape). Thus, it has a value of 0.2. On the other hand, abortion for any reason has a lower value thus, it has a higher value of 2.

    Is this the correct way of doing it?


  • #2
    Data example please using dataex. Also, look into the inlist function

    Comment


    • #3
      Jared Greathouse, thanks for looking into this.

      input int(year id) byte(age educ race income relig attend abdefect abnomore abhlth abpoor abrape absingle abany) float ab_scale
      1972 1 23 16 1 .i 3 2 1 1 1 1 1 1 .i .
      1972 2 70 10 1 .i 2 7 1 2 1 2 1 1 .i .
      1972 3 48 12 1 .i 1 4 1 1 1 1 1 1 .i .
      1972 4 27 17 1 .i 5 0 2 2 1 1 1 1 .i .
      1972 5 61 12 1 .i 1 0 1 1 1 1 1 1 .i .
      1972 6 26 14 1 .i 1 2 1 1 1 1 1 1 .i .
      1972 7 28 13 1 .i 2 7 1 2 1 2 1 1 .i .
      1972 8 27 16 1 .i 3 0 1 1 1 1 1 1 .i .
      1972 9 21 12 2 .i 1 3 1 2 1 2 .i 2 .i .
      1972 10 30 12 2 .i 1 8 1 2 1 1 1 2 .i .
      1972 11 30 13 2 .i 1 7 2 2 .n .n .n .n .i .
      1972 12 56 6 2 .i 1 7 2 2 2 1 2 1 .i .
      1972 13 54 9 2 .i 1 7 1 2 2 2 .d 2 .i .
      1972 14 49 8 2 .i 1 7 1 1 1 1 1 1 .i .
      1972 15 41 9 2 .i 1 8 1 1 1 2 2 2 .i .
      1972 16 54 14 2 .i 1 5 1 2 1 2 1 2 .i .
      1972 17 24 14 1 .i 1 7 2 2 1 2 2 2 .i .
      1972 18 62 8 1 .i 1 7 1 2 1 2 1 2 .i .
      1972 19 46 17 1 .i 1 7 1 1 1 1 1 1 .i .
      1972 20 21 14 1 .i 1 5 1 2 1 2 1 1 .i .
      1972 21 57 12 1 .i 1 5 2 2 1 2 1 1 .i .
      1972 22 58 11 1 .i 1 2 1 1 1 1 1 1 .i .
      1972 23 21 13 1 .i 1 1 1 1 1 1 1 1 .i .
      1972 24 26 12 1 .i 1 0 1 2 1 1 1 1 .i .
      1972 25 71 16 1 .i 1 3 1 1 1 1 1 2 .i .
      1972 26 53 12 1 .i 2 7 2 2 2 2 1 2 .i .
      1972 27 42 12 1 .i 1 2 1 1 1 1 1 1 .i .
      1972 28 42 12 1 .i 1 2 1 .d 1 1 1 2 .i .
      1972 29 20 12 1 .i 1 3 2 2 1 2 2 2 .i .
      1972 30 23 9 1 .i 1 7 1 2 1 1 2 2 .i .
      1972 31 26 6 1 .i 1 3 1 1 1 .d .d .d .i .
      1972 32 25 14 1 .i 1 7 1 2 1 2 1 2 .i .
      1972 33 26 16 1 .i 1 7 1 1 1 1 1 1 .i .
      1972 34 78 8 1 .i 1 7 2 2 2 2 2 2 .i .
      1972 35 21 12 1 .i 1 5 1 2 1 2 2 2 .i .
      1972 36 27 14 1 .i 2 3 2 2 1 1 1 2 .i .
      1972 37 58 13 1 .i 1 6 1 1 1 1 1 1 .i .
      1972 38 35 10 1 .i 1 8 1 2 1 1 1 1 .i .
      1972 39 58 6 1 .i 1 2 1 2 1 2 1 2 .i .
      1972 40 51 12 1 .i 1 8 .d 2 1 2 1 2 .i .
      1972 41 76 8 1 .i 1 8 1 2 1 2 1 2 .i .
      1972 42 53 14 1 .i 1 5 1 2 2 2 1 2 .i .
      1972 43 39 8 1 .i 1 5 2 2 1 2 2 2 .i .
      1972 44 64 8 1 .i 1 4 1 2 1 2 1 2 .i .
      1972 45 50 8 1 .i 2 7 2 2 1 2 1 2 .i .
      1972 46 27 12 1 .i 1 7 1 2 1 2 1 2 .i .
      1972 47 25 14 1 .i 2 7 1 1 1 1 1 2 .i .
      1972 48 49 12 1 .i 1 4 1 2 1 1 1 1 .i .
      1972 49 40 9 1 .i 1 6 1 2 1 2 2 2 .i .
      1972 50 43 8 1 .i 1 3 1 2 1 2 2 2 .i .
      1972 51 46 10 1 .i 2 0 1 1 1 1 1 1 .i .
      1972 52 37 14 1 .i 2 7 2 2 2 2 2 2 .i .
      1972 53 46 9 1 .i 2 5 1 1 1 1 1 1 .i .
      1972 54 22 12 1 .i 1 8 1 2 1 2 1 2 .i .
      1972 55 53 10 1 .i 2 6 1 1 1 1 1 1 .i .
      1972 56 35 12 1 .i 2 7 1 2 1 1 1 2 .i .
      1972 57 31 14 1 .i 2 3 1 2 1 1 1 2 .i .
      1972 58 30 12 1 .i 2 6 1 2 1 2 2 2 .i .
      1972 59 37 12 1 .i 1 3 1 2 1 1 1 1 .i .
      1972 60 57 11 1 .i 1 2 1 1 1 1 1 1 .i .
      1972 61 39 12 1 .i 1 1 1 1 1 1 1 2 .i .
      1972 62 62 9 1 .i 1 7 2 2 1 2 1 2 .i .
      1972 63 51 12 1 .i 1 3 1 1 1 2 1 2 .i .
      1972 64 43 11 1 .i 2 5 2 2 1 2 1 2 .i .
      1972 65 39 12 1 .i 1 6 1 2 1 2 1 2 .i .
      1972 66 52 8 1 .i 5 3 1 1 1 1 1 1 .i .
      1972 67 30 12 1 .i 2 1 1 2 1 1 1 1 .i .
      1972 68 47 12 1 .i 1 5 1 1 1 1 1 1 .i .
      1972 69 31 12 1 .i 2 7 1 2 1 2 1 1 .i .
      1972 70 25 16 1 .i 2 7 1 2 1 2 1 2 .i .
      1972 71 45 7 1 .i 1 8 1 2 1 2 1 2 .i .
      1972 72 30 12 1 .i 1 1 1 1 1 1 1 1 .i .
      1972 73 68 8 1 .i 2 7 2 2 1 2 1 2 .i .
      1972 74 63 11 1 .i 2 8 1 2 1 2 1 2 .i .
      1972 75 19 12 1 .i 2 1 .d 2 1 2 1 2 .i .
      1972 76 23 16 1 .i 4 0 1 1 1 1 1 1 .i .
      1972 77 46 10 1 .i 2 1 1 1 1 1 1 1 .i .
      1972 78 55 8 1 .i 1 0 1 2 1 2 1 1 .i .
      1972 79 22 14 1 .i 2 4 .d 1 2 1 1 1 .i .
      1972 80 55 12 1 .i 2 6 1 2 .d .d 1 2 .i .
      1972 81 44 7 1 .i 1 0 .d .d 1 .d 1 .d .i .
      1972 82 41 12 1 .i 1 6 1 1 1 1 1 1 .i .
      1972 83 49 15 1 .i 4 0 1 1 1 1 1 1 .i .
      1972 84 28 15 1 .i 1 7 1 1 1 2 1 2 .i .
      1972 85 21 14 1 .i 5 0 1 2 1 1 1 1 .i .
      1972 86 26 17 1 .i 1 3 1 1 1 1 1 1 .i .
      1972 87 31 20 1 .i 2 1 1 1 1 1 1 1 .i .
      1972 88 28 18 1 .i 5 0 1 1 1 1 1 1 .i .
      1972 89 26 17 1 .i 4 3 1 1 1 1 1 1 .i .
      1972 90 20 14 2 .i 2 6 1 1 1 2 1 2 .i .
      1972 91 25 16 1 .i 4 3 1 1 1 1 1 1 .i .
      1972 92 57 12 1 .i 1 2 1 1 1 1 1 1 .i .
      1972 93 58 13 1 .i 5 8 2 2 2 2 2 2 .i .
      1972 94 54 14 1 .i 1 0 1 1 1 1 1 1 .i .
      1972 95 35 16 1 .i 1 5 1 1 1 1 1 1 .i .
      1972 96 40 14 1 .i 1 2 1 1 1 1 1 1 .i .
      1972 97 57 15 1 .i 1 3 1 1 1 1 1 1 .i .
      1972 98 64 16 1 .i 1 5 1 1 1 1 1 1 .i .
      1972 99 34 15 1 .i 1 2 1 1 1 1 1 1 .i .
      1972 100 25 12 1 .i 1 7 1 1 1 1 1 1 .i .
      end
      label values year COUNTMISS
      label values id ID
      label values age AGE
      label values educ EDUC
      label values race RACE
      label def RACE 1 "white", modify
      label def RACE 2 "black", modify
      label values income INCOME
      label def INCOME .i "iap", modify
      label values relig RELIG
      label def RELIG 1 "protestant", modify
      label def RELIG 2 "catholic", modify
      label def RELIG 3 "jewish", modify
      label def RELIG 4 "none", modify
      label def RELIG 5 "other", modify
      label values attend ATTEND
      label def ATTEND 0 "never", modify
      label def ATTEND 1 "less than once a year", modify
      label def ATTEND 2 "about once or twice a year", modify
      label def ATTEND 3 "several times a year", modify
      label def ATTEND 4 "about once a month", modify
      label def ATTEND 5 "2-3 times a month", modify
      label def ATTEND 6 "nearly every week", modify
      label def ATTEND 7 "every week", modify
      label def ATTEND 8 "several times a week", modify
      label values abdefect YESNO
      label values abnomore YESNO
      label values abhlth YESNO
      label values abpoor YESNO
      label values abrape YESNO
      label values absingle YESNO
      label values abany YESNO
      label def YESNO 1 "yes", modify
      label def YESNO 2 "no", modify
      label def YESNO .d "don't know", modify
      label def YESNO .n "no answer", modify
      label def YESNO .i "iap", modify
      [/CODE]

      Comment


      • #4
        Originally posted by Muhammad Saifuddin View Post
        I am trying to create a 7-point scale. . . Is this the correct way of doing it?
        Wouldn't you compute it more along the following lines?
        Code:
        egen double sco = rowmean(abdefect-abany)
        summarize sco, meanonly
        replace sco = 1 + 6 * (sco - r(min)) / (r(max) - r(min))
        
        assert inrange(sco, 1, 7)
        If you want the seven-point scale to range from zero to six, then
        Code:
        replace sco = 6 * (sco - r(min)) / (r(max) - r(min))
        
        assert inrange(sco, 0, 6)
        If for some reason (I can't think of any) you want to coarsen the values, then you could use the round() function.

        Comment


        • #5
          As a side detail note that years in the 1980s can be selected by

          Code:
          if inrange(year, 1980, 1989)
          or

          Code:
          if floor(year/10) == 198

          Comment

          Working...
          X