Announcement

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

  • Imputation error: "Input too long"

    Dear all,
    I would like to impute a few hundred variables using custom imputation equations (conditionals and stuff). I am using a Python script to generate a do file that contains my very long "mi impute chained..." command. I am building this slowly and now I am hitting the error message "input too long". Any idea what to do here? Since this is a single command, I am not sure how I could split this up. Would it be helpful to rename variables to have shorter names?
    Best wishes

    Stata 18.0 MP | ORCID | Google Scholar

  • #2
    It is hard to tell which limit(s) you hit here. Assuming you do not have Stata BE, the number of characters in a command is limited at 4,227,159; that seems like a lot. Anyway, I think we need more information. For example, have you set trace on? If so, where does the error occur, exactly? What is the return code? Have you assessed the length of the string produced by the Python script? How long is it?

    Comment


    • #3
      Its not even 20 mins and the expert is already here, great! Thanks a lot for your reply! I am using Stata 16.1 MP x64 using Linux Mint. The dofile python creates for me has 505 lines, 58k "words" and 718k characters. I only have 3 commands in there, "mi set", "mi register" and then "mi impute", where the last one has 99% of the code. Set trace was off but changing it does neither change the outcome nor give any further insight. No return code is given.
      Best wishes

      Stata 18.0 MP | ORCID | Google Scholar

      Comment


      • #4
        The reported 718,000 characters is way below what is allowed in a single command. Which command produces the error message? It's strange that no return code is given.

        Comment


        • #5
          The error comes after "mi impute chained..." Would you like to see the complete command? Then I guess I need to upload it somewhere else...

          EDIT: Shortening variable names actually helps, now the commend runs. Still, this is not a good solution...
          Last edited by Felix Bittmann; 09 Jul 2024, 07:16.
          Best wishes

          Stata 18.0 MP | ORCID | Google Scholar

          Comment


          • #6
            I wonder if you might be hitting some internal limit of code being split across multiple lines?

            Comment


            • #7
              Try

              Code:
              set maxvar 32000
              The default is 5,000 and some of the limits for macros, etc. depend on c(maxvar).

              If that does not help, I would contact tech support. Your Stata version is off support but given that there is no return code, this cannot be intended behavior. At the very least, it should be possible for the average Stata user to get an idea of what the problem is.

              Comment

              Working...
              X