Announcement

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

  • Transforming 5 point scale into 3 point scale

    I created an online survey with several likert scale questions. Now I want to transform the 5 point variables into 3 point variables: "agree" "disagree" and "undecided"

    First I coded the varible like this:

    Code:
    cap drop government_behavior
    gen government_behavior = Q4
    lab var government_behavior "Government responds appropriately"
    lab def government_behavior 1 "strongly agree" 2 "rather agree" 3 "neither agree nor disagree" 4 "rather disagree" 5 "strongly disagree"
    lab val government_behavior government_behavior
    tab government_behavior
    How can I recode this into a 3-point scale? I tried this:

    Code:
    recode government_behavior 4/5=(0 "disagree") 1/2=(1 "agree") 3=(2 "undecided"), gen (government_behavior_new)
    But I always get the error code "command unab is unrecognized" (r 199) - What am I doing wrong??


    Thank you in advance.
    Last edited by larissa koegl; 28 Jan 2022, 06:20.

  • #2
    I have no idea where that error code is coming from but your syntax is not quite right; try the following (untested as there is no data example):
    Code:
     
     recode government_behavior (4 5=0 "disagree") (1 2=1 "agree") (3=2 "undecided"), gen (government_behavior_new)

    Comment


    • #3
      If the command unab -- an official Stata command used within recode -- is not recognised, then your installation of Stata is corrupt -- or someone has been messing with adopath. Bad news.

      EDIT

      https://www.statalist.org/forums/for...onse-variables reported another weird problem, which may be part of the same issue. You know how you obtained your copy of Stata. Anything other than a copy of Stata directly downloaded from StataCorp or an authorised distributor could be very messed up.
      Last edited by Nick Cox; 28 Jan 2022, 09:26.

      Comment


      • #4
        @nick cox: Indeed - it was also me who created the other post. And you were right - my version was not installed correctly. Now everything works as it is supposed to be. Thank you!

        Comment


        • #5
          Are you sure it’s a good thing to reduce the variability in the data?

          Normally, it’s not. But sometimes we have to, for instance if we have a problem with “empty cells” in an analysis.

          Comment

          Working...
          X