Announcement

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

  • 2 Likert scales - Encode string to numeric

    Hello everyone!

    I am doing data preparation for my master thesis. I conducted a survey in which I used two differente likert scales, both of 5 points:
    a) 1 Agree - 5 Disagree
    b ) 1 Always - 5 Never

    Case a). I have used the following command to label the string variables to number:
    label define likert 1 "Strongly disagree" ///
    2 "Somewhat disagree" ///
    3 "Neither agree nor disagree" ///
    4 "Somewhat agree" ///
    5 "Strongly agree" ///

    foreach v of varlist Worried_NC-Powerless_NC {
    encode `v', gen(_`v') label(likert) noextend
    drop `v'
    rename _`v' `v'
    }
    --> This worked perfectly.

    Case b). I used the same code:
    label define likert 1 "Never" ///
    2 "Sometimes" ///
    3 "About half the time" ///
    4 "Most of time" ///
    5 "Always" ///

    foreach v of varlist DifficultConcentrate_NC-TalkTooMuch_NC {
    encode `v', gen(_`v') label(likert) noextend
    drop `v'
    rename _`v' `v'
    }
    --> This time it did not work, I got the following message:
    label likert already defined

    My question: is there any way to have two different likert scales, each with different label values?
    Ultimately, what I want is to encode the string text into numeric.

    Thank you!

  • #2
    Originally posted by Eva Gonzalez View Post
    is there any way to have two different likert scales, each with different label values?
    There is a label language feature, but I'm not sure whether it will make things easier in your case.

    Is there a reason why you can't just give them separate names?
    Code:
    #delimit ;
    label define Agreement
        1 "Strongly disagree"
        2 "Somewhat disagree"
        3 "Neither agree nor disagree"
        4 "Somewhat agree"
        5 "Strongly agree";
    
    label define Frequency
        1 "Never"
        2 "Sometimes"
        3 "About half the time"
        4 "Most of time"
        5 "Always";
    #delimit cr
    
    foreach v of varlist Worried_NC-Powerless_NC {
        encode `v', generate(_`v') label(Agreement) noextend
        drop `v'
        rename _`v' `v'
    }
    
    foreach v of varlist DifficultConcentrate_NC-TalkTooMuch_NC {
        encode `v', generate(_`v') label(Frequency) noextend
        drop `v'
        rename _`v' `v'
    }

    Comment


    • #3
      Originally posted by Joseph Coveney View Post
      label define Agreement
      1 "Strongly disagree"
      2 "Somewhat disagree"
      3 "Neither agree nor disagree"
      4 "Somewhat agree"
      5 "Strongly agree";

      label define Frequency
      1 "Never"
      2 "Sometimes"
      3 "About half the time"
      4 "Most of time"
      5 "Always";

      foreach v of varlist Worried_NC-Powerless_NC {
      encode `v', generate(_`v') label(Agreement) noextend
      drop `v'
      rename _`v' `v'
      }

      foreach v of varlist DifficultConcentrate_NC-TalkTooMuch_NC {
      encode `v', generate(_`v') label(Frequency) noextend
      drop `v'
      rename _`v' `v'
      }[/code]
      It worked perfectly, thanks a lot!

      Comment

      Working...
      X