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

st: RE: RE: append multiple data sets


From   "Nichols, Austin" <ANichols@ui.urban.org>
To   "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
Subject   st: RE: RE: append multiple data sets
Date   Tue, 24 Aug 2004 12:09:41 -0400

Or, amending your original code:
********************************
program define apx
	local i = 1
		use timc`i', clear
	while `i'<=10 {
		append using timc`i'
		local i = `i' + 1
	}
end	
apx 
********************************
 Note that the original code uses a new dataset each time it repeats the
loop.

-----Original Message-----
From: David Harrison [mailto:David@icnarc.org]
Sent: Tuesday, August 24, 2004 11:48 AM
To: statalist@hsphsun2.harvard.edu
Subject: st: RE: append multiple data sets


Try the following...

use timc1, clear
forvalues i=2/10 {
	append using timc`i'
}

David
david@icnarc.org

-----Original Message-----
From: Leonelo Bautista [mailto:lebautista@wisc.edu]
Sent: 24 August 2004 16:40
To: statalist@hsphsun2.harvard.edu
Subject: st: append multiple data sets


I'm trying to append multiple datasets, but "append using" only adds two
datasets at a time. I tried the following program to append "timc1.dta",
"timc2.dta", "timc3.dta"... in one step, but it only appends two datasets.
 
********************************
program define apx
	local i = 1
	while `i'<=10 {
		use timc`i', clear
		append using timc`i'
		local i = `i' + 1
	}
end	
apx 
********************************

I'll appreciate any suggestions on how to accomplish this task.

Leonelo Bautista

*
*   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/



*
*   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/
*
*   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