Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: Combining two datafiles- Union(AND), not Intersection (merge) or Stack (append)
From
Mani Subramani <[email protected]>
To
[email protected]
Subject
st: Combining two datafiles- Union(AND), not Intersection (merge) or Stack (append)
Date
Thu, 21 Mar 2013 09:46:52 -0500
I have a large datafile with activities of traders in different
periods (transaction file) and a master list of the total set of
traders.
I want to create a file that combines observations in the two files (Union).
What I am looking for is not a merge or append but a Union where
unique rows in my
Masterfile that are not present in my transaction file are added..and
the total number of rows in the final file is the same as the number
in my Master file.
Below is an explanation with made-up numbers for simplicity.
I have spent a lot of time trying to work this out..and I have the
feeling there is a simple way to do this that I missing.
Thanks in advance
-----------------------------------------------
Transaction file ( 4 rows - 1 per trader where I have data - 4 columns
in table) eg
Trader period1 period2...period30
A 23 2 17
B 23 2 17
F 23 2 17
H 23 2 17
I have a master list of traders with just names e.g 26 rows , 1 column
A
B
.
.
Y
Z
I need to create a file that will have the union of data in the two
files (ie it will have 26 rows, with names of traders A-Z when
combined) and will contain
26 rows and 4 columns presenting trading activity data in rows where I
have them
eg. combining the two files above, I want a file with
Trader period1 period2...period30
A 23 2 17
B 23 2 17
C . . .
C . . .
E . . .
F 23 2 17
G . . .
H 23 2 17
. . .
Y . . .
Z . . .
==================================
Mani Subramani, [email protected]
Information and Decision Sciences Department
Carlson School of Management, University of Minnesota
Minneapolis, MN 55455.
612-624-3522
*
* 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/