Announcement

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

  • Unable to access do-file

    Greetings

    I am working on stata and using a do file that i have been successfully opening every time i need to use it. However i am now trying to access it and there is a pop up window displaying "The document is not encoded in UTF-8". I am therefore unable to access my do file. Please help.

    Kind Regards
    Nonsi Nkomo

  • #2
    I'm not entirely sure what's happened. But can you try to open the DO-file in notepad?

    If so, you can copy its contents and place them in a new DO-file.

    Comment


    • #3
      Hi Jesse

      I have tried that but it shows some code that I am unable to read.

      Kind Regards
      Nonsi Nkomo

      Comment


      • #4
        If you type "viewsource file.do" from Stata from the file's directory, does it help? If not, what is the output of "unicode analyze file.do"?

        Comment


        • #5
          Hi Mauricio

          I have opened Stata and typed in "viewsource D:\Trial\redo.do."I am get the response, "file "D:\Trial\redo.do" not found."

          Typing in "unicode analyze D:\Trial\redo.do" I get

          Code:
          unicode analyze D:\Trial\redo.do
          no; data in memory would be lost
              unicode syntax is
                  unicode analyze      filespec
                  unicode encoding set encoding
                  unicode translate    filespec [, ...]
                  unicode retranslate  filespec [, ...]
                  unicode restore      filespec [, ...]
          
              analyze and [re]translate can handle Stata datasets as well as text files such as
              do-files, ado-files, help files, etc.
          
              There must be no data in memory.  See help unicode

          Comment


          • #6
            viewsource only looks along your adopath. But that always includes the working directory or folder. So, try

            Code:
            cd D:\Trial 
            viewsource redo.do
            Alternatively, type will look where you tell it.

            Code:
            type D:\Trial\redo.do
            But both are irrelevant if you already have looked inside the file, as your report implies.

            I don't think anyone can easily help unless you show us "some code that I am unable to read" (#3).

            Comment


            • #7
              Hi Nick

              The code I am unable to read is as shown below. This is what appears after using viewsource.

              Code:
              mP
              9`UvX$
              "çï‚QuŒ1êÔzÄÔ[ÚLÊ¡²xN‡
              ¹½.,6³ßÝMýK)6ÚrNUWž*êœYˆ‰qÆÐ÷ïOI¨éwÞêÀ´Å1ßÜu6˜þS{ÇiÖ*Ye<²fü\[Ñë8lé+{vyâ5/”|Ьp’DîYQ_Æñ1áXÓ¬VÁ2ü
              > Iþ«kþéçÐyôgÊéÙŒ$œŸ¦3§xqh‚9³d*ª‘ÓÚ´Ús%.22H/µº„»¸éºÆ7¥Ç*1ËtÓ ü•67ÇæBm†$N٤“¾ÛÊl$3¦
              
              !á•™rßèB3îx—QÑ9JƒX/Ùð,uT¹–¢S9Ktø=®™‹ŸÑ·µ¤*://‹>p^7»î«¦
              #Œ”çÐmÞõ‚N7vövÃ~ÌŒ€)шZ+-4e)|Y,`ñÃ
              d®²ªú[#BÝiÉ{›ÌJ£8B.õào_*/â“ã-Ø»úe§è§R;‚2?Ÿ=ifÖ®ÑàœÃ¯.·lrqºØ$Pì

              Comment


              • #8
                Looks corrupted to me. I was in hopes that it was really a dataset in disguise, but not so.

                Comment


                • #9
                  So there is no way to recover the do file?=/

                  Comment


                  • #10
                    Please note that in post #5 Stata unicode analyze made no conclusion about the do-file, either positive or negative. It simply reported that it would not process the do-file because there was already data in memory, and that data would be lost if it proceeded. If you run unicode analyze before loading data into memory, or if you clear your working dataset from memory, so that Stata does not worry that you will lose your work, before running unicode analyze, then it may run.

                    So the output in post #5 says nothing useful about the do-file.

                    With that said, I agree that the file is probably corrupt. But unicode analyze might tell you something if it were run successfully.

                    Comment


                    • #11
                      Perhaps too late for you, but I am pretty fanatical about backing up my work. I store most of my current work in Dropbox folders. You can get quite a bit of free storage with Google Drive. Box and Onedrive are other options. I also back up my HD to an external drive every night. Every few months I backup my HD to an external drive which I take off-site. Barring massive and simultaneous equipment failure (e.g. computer and external drive both die at the same time), my theory is that I will never lose more than a day's work.

                      If you are working on a school or work computer, it is possible that you have a backup you don't even know about. If not, then learn from painful experience so you have a decent backup system in the future.
                      -------------------------------------------
                      Richard Williams, Notre Dame Dept of Sociology
                      StataNow Version: 19.5 MP (2 processor)

                      EMAIL: [email protected]
                      WWW: https://www3.nd.edu/~rwilliam

                      Comment


                      • #12
                        I have managed to create a new do-file and recreate what I had previously lost. I have also now backed up my do-file, which I should have done in the first place. Thank you all for the help.

                        Kind Regards
                        Nonsi Nkomo

                        Comment

                        Working...
                        X