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: Merging data files in .txt format


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Merging data files in .txt format
Date   Mon, 26 Nov 2012 10:44:33 +0000

You don't say why you want to merge (or -merge-) these datasets. For
almost all analyses, -append- will make much more sense.

I don't think there is an easy answer independent of the exact
contents of the files and your computer skills. A wild guess is that
the files don't themselves contain the quarter to which they refer, so
it may be easiest to read in the files one by one into Stata, make
sure that the quarter is copied to a variable within the dataset, and
then -append- to the cumulating dataset.

It's also possible that you can combine the files outside of Stata
using some scripting language and then read them into Stata just once.

Nick

On Sun, Nov 25, 2012 at 6:41 AM, David Ashcraft
<ashcraftd@rocketmail.com> wrote:

> I have data files saved as .txt with titles bhcfQQYY where QQ is the quarter number and YY is the two digit year. I want to import and merge these files (48 in total) as one data set.When I am using -insheet-  importing all data as one variable (one column multiple rows) I digged it and found the problem as the data is using special character "^" for separating variables for each observation. Although I have solved this problem. But mow my problem is merging of data. Do I have to change each file and then merge or is there any other straight way to do it?

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index