Announcement

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

  • reshape command

    Hello everyone, I faced with problem in applying reshape command. pls help.
    when i run this: reshape long q1 q2 q3 q4 q5 q6 q7 q8 q9 q10, i(id) j(hhm)

    error message showed: variable q14 type mismatch with other q1 variables

    but if I drop variable q14 command work without error but also without q14


  • #2
    So, q14 is numeric and the others are string, or the other way round. The first problem is to fix that so that all variables that should be of the same type are indeed of the same type.

    Show us the results of

    Code:
    describe q*


    Beyond that, I suspect your syntax is confusing stub names and variable names. reshape long wants to see stub names not variable names. So for example if you say that q1 and q10 are stub names, reshape wants to regard q11 q12 q13 q14 as variables that belong together with common stub q1. I doubt that is what you want to do.

    Comment


    • #3
      many thanks for reply Nick. I could not solve my problem using your comments. I am sharing with you data file. I will be very grateful for your help.
      Attached Files

      Comment


      • #4
        Originally posted by Nick Cox View Post
        So, q14 is numeric and the others are string, or the other way round. The first problem is to fix that so that all variables that should be of the same type are indeed of the same type.

        Show us the results of

        Code:
        describe q*


        Beyond that, I suspect your syntax is confusing stub names and variable names. reshape long wants to see stub names not variable names. So for example if you say that q1 and q10 are stub names, reshape wants to regard q11 q12 q13 q14 as variables that belong together with common stub q1. I doubt that is what you want to do.
        many thanks for reply Nick. I could not solve my problem using your comments. I am sharing with you data file. I will be very grateful for your help.

        Comment


        • #5
          Originally posted by Dastan Aseinov View Post

          many thanks for reply Nick. I could not solve my problem using your comments. I am sharing with you data file. I will be very grateful for your help.
          the data
          Attached Files

          Comment


          • #6
            We ask that you don't post .dta files (FAQ Advice #12).

            Exceptionally I had a look and find that it's mostly string variables in a language I don't understand, perhaps Russian. It looks as if your variables should be stacked somehow using the stack command. q14 would need to be pushed through destring, perhaps.

            reshape long has little scope for getting you where you want to be unless you rename variables more systematically.

            Comment


            • #7
              I appreciate all your help, Nick.

              I express my deepest apologies for not having looked through all the rules.

              String variables in the Kyrgyz language, which uses the Cyrillic alphabet just like in Russian. I apologize for not translating from Kyrgyz into English, considering the language in which the content is expressed to be not crucial.

              I will try to solve it using the stack command.

              Comment

              Working...
              X