Announcement

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

  • Update Nov,. 15th: Can't export anyport

    Hi,
    after updating to the last version of Stata 18 on Mac, I can't export anymore, not to Excel, SPSS... I get the error message:

    Error writing observation : 1
    r(680);

    But that's not really helpful.
    Is it possible to reset Stata to pre-update version?

    Thanks
    Nick

  • #2
    You don't show the code that produced the error or the text message accompanying the return code, and there is no r(680) error code listed in the error entry of the user's manual, but it does have this to say there if it's any help in diagnosing what could be the problem: "Return codes 630–696 are all messages that you might receive when executing any command with a file over the network."

    Comment


    • #3
      The code is the usual export code for SPSS, Excel...

      Comment


      • #4
        Originally posted by Nick Bornschein View Post
        The code is the usual export code for SPSS, Excel...
        The location and name of the destination file?

        Comment


        • #5
          It's a folder on my Mac. No special characters. I used it yesterday, before the update, and it worked.

          Comment


          • #6
            I also have the same issue. The export spss command no longer works with StataNow/18.5. It worked correctly with previous Stata versions.


            Error writing observation : 1
            r(680);

            Same error,

            both on a local file path
            export spss using C:\Users\midvyd\Desktop\test.sav

            as using an iCloud folder:
            export spss using "C:\Users\midvyd\iCloudDrive\03 Projects\[...removed for privacy...].sav"

            (I notice, now, the difference in quotation marks between the two paths, but I am using the dialog boxes here.)

            Comment


            • #7
              I am using Stata/SE 19.5 and I have the same problem: export spss generates the error message "Error writing observation", hence the problem is not restricted to Stata 18 or 18.5.

              Here a code snippet with output:
              Code:
              . d, s
              
              Contains data from /datadisk/Projekte/ISRD4/Data/MK/ISRD4-SQ_MK.dta
               Observations:         2,106                  ISRD4 Data North Macedonia, created by 'MK_genend-sq.do' (10
                                                              Aug 2025)
                  Variables:           570                  10 Aug 2025 05:20
              Sorted by: casenum
                   Note: Dataset has changed since last saved.
              
              . di _n "${path}${data}.RawSav"
              
              /datadisk/Projekte/ISRD4/Data/MK/ISRD4-SQ_MK.RawSav
              
              . export spss using "${path}${data}.RawSav", replace
              Error writing observation : 1
              r(680);
              
              end of do-file
              
              r(680);
              
              .
              Longer and some time consuming syntax commands precede the code snippet shown. Note that when I run that code until the display command (di) first and subsequently run only export spss ... the export command runs without error. Hence, the path is correct and the problem occurs with Stata/SE 18.0 as well as with Stata/SE 19.5. I tried to precede export spss with sleep 5000, but this does not help either.

              My operating system is Linux (Ubuntu 20.04). Similar jobs did not have this issue and using simply the famous auto dataset runs without problems, as well.

              Comment


              • #8
                At least in my case I could locate the problem (although I don't understand why it would cause the error message of export spss): The data contained the (temporary) variable __000000. After having deleted this variable the export command runs without error.

                It is quite possible that this was also the cause of the problem in #1 and #6. In my opinion, however, this should not happen (StataCorp should take steps to prevent this from happening in the first place).

                Note that some time ago I already warned to have data containing temporary variables when saving them, see here and here.

                Comment


                • #9
                  The current library we use to export SPSS files does not support variable names that start with an underscore.

                  Code:
                  . sysuse auto, clear
                  (1978 automobile data)
                  
                  . generate _a = 1
                  
                  . export spss test.sav, replace
                  Error writing observation : 1
                  r(680);
                  We have revised the error message to provide a clearer description of the problem and will update the documentation accordingly. These changes will come out in a future update.

                  Comment


                  • #10
                    It would be nice if that fact about variable names beginning with an underscore were in the user documentation.

                    Comment


                    • #11
                      In the newest version of Stata 19.5, the error message has indeed been updated to a more helpful one:

                      Code:
                      . clear all
                      
                      . qui set obs 1
                      
                      . gen _a = 1
                      
                      . export spss test.sav, replace
                      invalid export variable name:
                          A variable name begins with an illegal character.
                      r(680);
                      However, trying to export a .sav file with a variable whose name is longer than 64 bytes still gives the old error message:

                      Code:
                      . clear all
                      
                      . qui set obs 1
                      
                      . gen ὸὸὸὸὸὸὸὸὸὸὸὸὸὸὸὸὸὸὸὸὸὸ = 1
                      
                      . export spss test.sav, replace
                      error writing observation : 1
                      r(680);
                      Stata variable names can be up to 32 characters long, while SPSS variable names can be up to 64 bytes long. The example variable name above is 22 characters long, meaning it is short enough for Stata, but each character is three bytes, making it 66 bytes, too long for SPSS.

                      Just documenting this for anyone who might run into and Google the old error message. It could plausibly appear for anyone with variable names in a language where characters are often 3 or 4 bytes, including Mandarin, Japanese, Korean, Arabic, Hindi, and Bengali, among others.

                      Comment

                      Working...
                      X