Announcement

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

  • Using 'forval'

    Dear All,
    I've 76 variables with Likert scale entries (with 5 options). I'm converting the options to binary: 1 & 0. That is, 1,2,3=0 and 4, 5=1. I was able to use the 'recode' command to do this for only 1 variable. How can I do same for all the other variables at the same time using the 'forval' command?

    Alternatively, I wanted to use the replace command. E.g replace x=1 if inrange(x, 4, 5); replace x=0 if inrange(x,3,4,5). But then, this is for only one variable. I want to do for all the variables at the same time

    Thanks,
    Dapel
    Last edited by Zuhumnan Dapel; 16 Aug 2018, 09:03.

  • #2
    Discarding information by combining categories is often not a good idea. Anyway, recode allows a varlist, so you do not need a loop.

    Best
    Daniel

    Comment

    Working...
    X