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" <katu@ier.hit-u.ac.jp>
To   statalist@hsphsun2.harvard.edu
Subject   st: Re: split, combine and verify datafile(s)
Date   Mon, 20 Jun 2005 22:21:40 +0900

Michael,

Thank you for your quick and detailed suggestion.
And I'm sorry for my late reply.

As you say, I still don't fully understand how to use 
-tempfile-, and your instruction is of much help.
Following your advice, I re-modified the codes and it ran 
successfully.

Besides, as you point out, I surely brought unnecessary 
complications to the codes by using a macro as part of the 
tempfile name.  
Instead, I simplfied the codes as below:

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

And it also ran successfully.

P.S.
There seems no handy command in Stata to verify the 
consistency of two files.
# though commands to verify the consistency of two 
variables exist.
Maybe using -summarize- etc. before/after splitting the 
datafile is the easiest way to do so.

K.I.
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index