Announcement

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

  • Is there an easy way to rename multiple variables?

    Hi, I have a wide dataset and variable names are like
    Code:
    v1, v2, v3,..., v100.
    I want to drop v3 and v10 then rename v4 to v3, v5 to v4,....and then v11 to v9, v12 to v10, so on and so forth.
    I know I have to use
    Code:
     v`'
    or loop, but a bit struggling now.

    Thanks.

  • #2
    Code:
    drop v3 v10
    rename v# v#, renumber

    Comment


    • #3
      Code:
      help rename group

      Comment


      • #4
        Hi, I checked help and find out it is possible that
        Code:
        rename (a b c) (b c a)
        .
        I was wondering if
        Code:
        rename (a b c d g e f) (b c a e f d g)
        is also possible.
        Or only three elements are the maximum number.

        Comment


        • #5
          Why not try it?

          Comment


          • #6
            Ni Nick, I tried but nothing happened.

            Comment


            • #7
              This thread is almost the same as https://www.statalist.org/forums/for...iple-variables. May I suggest that this thread be considered closed?

              Chul-Kyoo Jung Please look at the other thread. The solution to your problem is there, I believe.

              Comment


              • #8
                Clyde Schechter yes, sure. thanks again.

                Comment

                Working...
                X