Announcement

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

  • Importing previously imputed data using mi import

    Hello Stata Users,
    I have been trying to import previously imputed data (m=0, 1,2,…..20) using mi import command. The data set includes the original un-imputed data(m=0) which has missing values and 20 (m=1,2,3.....20) imputed datasets. Below is my code:

    mi import flong, m(imp_number) id(record_id) imputed(v1 v2 v3 v4 v5 v6)

    When I run the above code it returns with an error message.

    “variable record_id has invalid values
    record_id takes on at least one value if imp_number>0 that it does not if imp_number==0”


    However, the same code works if I delete the original data and import only imputed datasets. But the problem is it takes first imputed dataset (m=1 reads as m=0) as original and takes remaining 19 imputed dataset which is not correct.

    Can anyone please help me in importing the data with the original included?

    Thanks in advance.
    Baker

  • #2
    I'm confused; why do you want to import the data? why not just -use- it?

    Comment


    • #3
      The data is in an excel file and it has imputation number as a column. To be able to use it I need to import the data to Stata.

      Comment


      • #4
        sounds like you want -import excel-

        Comment


        • #5
          Yes, the imputed data is stored in an excel file.

          Comment


          • #6
            I was trying to follow the description in the below link
            https://www.stata.com/manuals/mimiim...imiimportflong

            Comment


            • #7
              Originally posted by Baker Chowdhury View Post
              When I run the above code it returns with an error message.

              “variable record_id has invalid values
              record_id takes on at least one value if imp_number>0 that it does not if imp_number==0”
              I am facing the same issue: Stata generates more observations in the imputed dataset than in the original one. If you have this issue, then there's a problem (that I don't know how to solve, since the number of observations in each imputed dataset should be equal to the one in the original one). If, instead, your original sample includes observations that have all missing values, I think that, since they're not giving any information, they should be dropped from the beginning.

              Comment

              Working...
              X