Announcement

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

  • import command giving 'data has changed' even after a -save- command

    Hi all,

    Lately I've been having this issue and kept ignoring and addinc -clear- to all -import- calls for a long time but decided to ask in case there is a problem.

    In my do files I'm always intentional not to use clear/replace/force options automatically and only include them when I know i want that kind of destructive action.
    I've been observing that -import- command gives the 'data has changed' error even if it should not, i.e. if there is a -save- command just before it.

    So, basic repro steps would be, in a freshly opened Stata instance (StataNow, with latest update) to run:

    . sysuse auto
    . generate aa = 1
    . tempfile bb
    . save `bb'

    . import excel 'some_excel_file'
    no; data in memory would be lost
    r(4);

    . display c(changed)
    0

    Anything I may be misinterpreting or not aware of changes in how these commands are intended to work?

    Thanks a lot,
    Zurab

  • #2
    I can verify that I replicate this on my system, and also that the same thing happens with -import delimited-. Now, in the help file for -import excel- I do not see anything that says when the -clear- option is needed. But in the help file for -import delimited- it specifically says
    clear specifies that it is okay to replace the data in memory, even though the current data have not been saved to disk.
    which implicitly entails that -clear- should not be required if the current data have been saved to disk. So this sounds like a bug to me. I suggest you report it to Stata Tech Support.

    By the way, the same thing happens in version 17. I do not have older versions available to check.

    Comment


    • #3
      Thanks Clyde,

      I happen to still have Stata 12, so after you mentioned, decided to test, the same error happens there. So this is clearly not something recent.

      And of course, if instead of -import- I call -use- to open another Stata dataset everything works as expected, i.e. no error is given.

      Comment

      Working...
      X