Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: Infile several ASCII files


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: Infile several ASCII files
Date   Wed, 31 Mar 2010 21:51:50 +0200

<>

" infile `F'"




-infile- requires a mandatory -varlist-, though, and the -using- qualifier:

- infile var1 var2 using `F'-

HTH
Martin


-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Jeph Herrin
Sent: Mittwoch, 31. März 2010 21:41
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: Infile several ASCII files

Oops, obviously the -tempfile- isn't used or needed.

cheers,
J

Jeph Herrin wrote:
> I think you have to loop over your files, something like:
> 
> 
> clear all
> local myfiles file1.txt file2.txt file3.txt
> foreach F in `myfiles' {
>     tempfile file`F'
>     infile `F'
>     capture confirm file myfile.dta
>     if _rc==0 {
>         append using myfile
>     }
>     save myfile, replace
>     clear
> }
> 
> hth,
> Jeph
> 
> 
> Andrzej Niemierko wrote:
>> I have a data management problem. My data are stored in several ASCII 
>> (.txt)
>> files. Each file has the same number of observations (in the same 
>> order). I
>> can -infile- each file individually, but I would like to -infile- all of
>> them and combine them into a one dataset. I cannot figure out how to 
>> do it
>> as -infile- refuses to work if data are already in memory. I suspect that
>> someone has already faced that problem and knows the solution. Any ideas?
>> Andrzej
>>
>>
>>
>>
>> The information in this e-mail is intended only for the person to whom 
>> it is
>> addressed. If you believe this e-mail was sent to you in error and the 
>> e-mail
>> contains patient information, please contact the Partners Compliance 
>> HelpLine at
>> http://www.partners.org/complianceline . If the e-mail was sent to you 
>> in error
>> but does not contain patient information, please contact the sender 
>> and properly
>> dispose of the e-mail.
>>
>> *
>> *   For searches and help try:
>> *   http://www.stata.com/help.cgi?search
>> *   http://www.stata.com/support/statalist/faq
>> *   http://www.ats.ucla.edu/stat/stata/
>>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
> 
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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   |   Site index