Announcement

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

  • Unable to reshape multiply imputed data

    Hello,

    I am unable to reshape my data into long format to run a fixed effects model. As can be seen in the STATA command I imputed variables with missing data and later converted the data into flong. However, When I tried to reshape the data to long by indicating the specific variables for i and j I received the following error message.

    HTML Code:
    set seed 832016
    mi set wide 
    mi register imputed INF_M6a INTSCORE_M6 PWAS_M_1 PWAS_M_2 FAM_M3 FAM_M6 OYAS_FINAL_C 
    mi impute chained (nbreg) INF_M6a (poisson) INTSCORE_M6 (regress) PWAS_M_1 PWAS_M_2 (logit) FAM_M3 FAM_M6(ologit) OYAS_FINAL_C = INF_M3a INTSCORE_M3 PWAS_M_0 VIC_M3a AGE_AD MILES LENGTH2 dummy_race, add(25) force dots augment
    mi convert flong
    mi reshape long INF BAI BDI INTSCORE PWAS MILES AGE_AD FAM VIC OYAS LENGTH EXIT RACE, i(ID) j(time)
    Thank you for your assistance with this matter, [HTML]/HTML]

  • #2
    Just following up on my last post. I noticed that the table did not copy in the delimiters so here is my second try.

    [HTML]
    . mi reshape long INF BAI BDI INTSCORE PWAS MILES AGE_AD FAM VIC OYAS LENGT
    > H EXIT RACE, i(ID) j(time)
    reshaping m=0 data ...
    (note: j = 2)
    (note: INF2 not found)
    (note: BAI2 not found)
    (note: BDI2 not found)
    (note: INTSCORE2 not found)
    (note: PWAS2 not found)
    (note: MILES2 not found)
    (note: AGE_AD2 not found)
    (note: FAM2 not found)
    (note: VIC2 not found)
    (note: OYAS2 not found)
    (note: EXIT2 not found)
    (note: RACE2 not found)
    variable MILES already defined
    /HTML]

    Thank you in advance.

    Comment


    • #3
      I'm not sure it makes sense imputing before you reshape. I suspect that the reshape results in the assumptions in the impute not holding.

      Comment


      • #4
        have you looked at:
        Code:
        help mi reshape
        if you want actual code help, please show the data using -dataex- (see the FAQ for more on this)

        Comment


        • #5
          Thank you both for responding. I was able to figure out the problem. My ID was a string and the stubnames were followed by numbers such as 3 and 6 or 1 and 2. I think that was throwing STATA off in creating the time variable. I fixed it so all the variables that needed to be reshaped would be 1 and 2 only.

          Comment

          Working...
          X