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

st: RE: RE: AW: How can I merge two records within the same dataset?

From   "Nick Cox" <>
To   <>
Subject   st: RE: RE: AW: How can I merge two records within the same dataset?
Date   Fri, 28 Aug 2009 14:53:55 +0100

If this is any kind of restructure, it strikes me as a -reshape-. But a
-reshape- by the sound of it would leave many missing values for those
companies represented just once. I think you could end up worse off. 

It seems to me that what you need is ways of dealing with two or more
records when makes sense and with one record when makes sense. -by:- and
-egen, tag()- are your friends. 


Karen Bonner

I can order the data by name and from that identify when companies are
represented multiple times. There are some companies where there are
more than two records which need merged. 

Martin Weiss

Is there a way to tell which company is represented multiple times w/o
through the entire dataset? If so, are there -exactly- two records for
company in need of a -merge-, or could there be multiple ones?

Karen Bonner

I have a wide dataset with variables spanning from 1999-2008. Each row
of the dataset should contain a unique record relating to a company,
however I have several cases in which the id for the company changed
over time and thus the data for one company is contained on two separate
rows e.g from 1999-2003 is contained on row 1 and the data for 2004-08
for the same company (although under a different id) is on row 2. I
would like to know if there is a way to merge these two rows into one
without having to replace the observation for each individual variable
one at a time? 

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index