Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: split, combine and verify datafile(s)


From   "Katsuhide Isa" <[email protected]>
To   [email protected]
Subject   st: Re: split, combine and verify datafile(s)
Date   Sat, 18 Jun 2005 21:18:19 +0900

Michael,

Thank you for your suggestion.
Following your suggestion, I modified the original codes as 
follows:

foreach file in sysdsn32 sysdsn33 sysdsn34 {
	use `file'
	sort patid
	tempfile `file'_temp
	save ``file'_temp'
	use sysdsn31
	sort patid
	capture drop _merge
	merge patid using "`file'_temp"
	save sysdsn31, replace
}

But when running these codes, I got an error, saying

file sysdsn32_temp.dta not found
r(601);

What would be the problem?
Or there may be any misunderstanding in my modification.

Any suggestions welcome.
Thanks in advance.

K.I.

----------
>The problem is that your tempfile command is doing nothing but reserving a 
>name for a tempfile.  The save command precedes it and uses a valid 
>filename, so those files are saved and are left behind at the end of the 
>program.  If you want them to be tempfiles you need to change the order of 
>the commands and fix the save command:
>
>tempfile `file'_temp
>save ``file'_temp'
>
>Note that the save command needs to have the tempfile name enclosed in 
>single quotes because tempfile creates a local macro.
>
>Michael Blasnik
>[email protected]
>

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index