Announcement

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

  • Recuperate a temp file

    I have created a temp dta in order to do an append but unfortunately stata didn't recognize a command just after the append and before I saved the file with the official name. Is it possible to recuperate this temp dataset?
    I have created it as below. It did not recognize the -mdesc- command once I didn't have the specific package in stata.

    Code:
    clear
    tempfile temp
    save `temp', emptyok
    foreach k in AC AL AM AP CE DF ES GO MA MS MT PA PB PE PI PR RN RO RR SC SE TO RS RJ MG BA SP {
    foreach x in 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 {
    use ${DO}/DO`k'`x'.dta, clear
    append using `temp'
    save `"`temp'"', replace
    }
    }
    use `temp', clear
    mdesc
    compress
    save ${DO_T}/DOBIT_BR_96a13_T.dta, replace
    clear

  • #2
    I am sorry, I don't completely understand your question and the example you gave is not reproducible so I cannot test it on my PC. Are you saying that you saved some data in a temporary file and that you would like to find that temporary file? That may be possible but is unlikely. From help macro:

    tempfile assigns names to the specified local macro names that may be used as names for temporary files. When the program or do-file concludes, any datasets created with these assigned names are erased.
    A Stata temporary files FAQ from 2004 explains where Stata stores temporary files. You can go to that folder and look for files that may be Stata temporary files. Copy them to a new location, change the suffix from .tmp to .dta and see if one of them is the file that you are looking for.

    If you are asking how to save the file that you created with the code above, either (a) delete the mdesc command or (b) install the mdesc package from SSC and then run the same code.
    Code:
    ssc install mdesc

    Comment

    Working...
    X