Announcement

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

  • #16
    Phil, the very last question on the topic. I don't understand from the code (and from the Stata guides) if the tempfile `result' is eventually transformed into a 'real' file on the disk. Looking at the code, I fear it might disappear once the routine is finished.

    Comment


    • #17
      Originally posted by riccardovalboni View Post
      I don't understand from the code (and from the Stata guides) if the tempfile `result' is eventually transformed into a 'real' file on the disk. Looking at the code, I fear it might disappear once the routine is finished.
      Good question, but keep in mind that the file `result' is a real file on disk; it's just that it's stored in a temporary location, and automatically deleted by Stata. If you run the code I showed above, you will be left with the final dataset in memory, so if you want to save it to a more permanent location at that point, then you can add a call to save at the end. In fact, you could replace `result' with a non-temporary file of your choice, if you want, without causing any problems.

      FYI, most of the data manipulation code I write is intended not to be run directly, but to be invoked by code somewhere else. This makes it easier to reuse. As a result, the final save comes not in the do-file(s) that perform the manipulation, but in the location where those do-files are called. For example, in your case, you might want at some point to use this same procedure to retrieve a different set of variables, say, for a different project. In that case, you might want to pass in the <varlist> and name of file A as parameters, and, after this code is executed, save the result to a different file.

      Alternatively, you can just ignore the paragraph above, at least for now. As I said, my choice in this case to save the result to a temporary file was more habit than anything else.
      Last edited by Phil Schumm; 29 Jun 2014, 09:48.

      Comment


      • #18
        I perfectly see what you say. It's a sound practice. I will keep that in mind from now on.

        Comment

        Working...
        X