Announcement

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

  • Scaling variables in stata

    I have a dataset that has all numerical answers in the range of 1 to 5 (including decimals). An example of this is below:

    Code:
    .                Var1        Var2           Var3
    Respondent1      3,46        4,81           1,44
    Respondent2      2,90        4,23           3,99
    Respondent3      1,57        3,78           2,82
    I need to scale these numbers up to a 1-10 scale, in witch 1,00 stays 1,00 and 5,00 becomes 10,00. All other numbers need to be scaled appropriately in between. I could not find an easy way to scale variables like this. Can anyone tell me how to do this or point me in the right direction/ towards appropriate documentation?

  • #2
    Hi Sem,

    Wouldn't you obtain just that by multiplying your variables with 2?

    Comment


    • #3
      Hi Mathias,

      That would not be possible because my 1,00 would then turn into a 2,00. I need the variable to stretch appropriately, spreading over a 1-10 range and not a 2-10 range.

      Comment


      • #4
        Sounds like you need to strectch 1-5 to 1-10, or stretch a difference of 4 to 9


        Starting from v1 in below sample, do:
        Code:
        g v2 = var1-1
        g v3 = (v2/4)*9
        g v4 = v3+1
        Code:
        * Example generated by -dataex-. To install: ssc install dataex
        clear
        input float(var1 v2 v3 v4)
           1         0        0      1
           5         4        9     10
        2.83      1.83   4.1175 5.1175
         1.2 .20000005 .4500001   1.45
        end
        Also note how I used dataex to paste that sample here. This allows other users to copy your data into Stata, which doenst work with the sample you provide. Please install and use it in future posts.

        Comment


        • #5
          Hi Jorrit,

          Thank you for your reply. Turns out simple math can do the trick, I totally did not think of that myself. I will install and use dataex for future posts, thank you for your time!

          Comment

          Working...
          X