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

st: -replace- suggestions?


From   "Terra Curtis" <[email protected]>
To   <[email protected]>
Subject   st: -replace- suggestions?
Date   Wed, 14 Dec 2005 15:23:26 -0500

Dear Statalist,

I am working with a panel dataset of companies.  Company names consist of
one company, A for example, or two companies, A/B for example, when A and B
have entered into an agreement.  An example of this data looks like:

Coname	year		othervars...
------	----		---------
A		1990			.
A		1991			.	
A		1992			.
A/B		1989			.
A/B		1990			.
A/B		1991			.
.
.
.


What I would like to do is to replace coname="A" if coname=="A/B" AND (this
is the part I need help coding) company A also has data for that year.  So
in the above example, the end result after the replace would be:

Coname	year		othervars...
------	----		---------
A		1990			.
A		1991			.	
A		1992			.
A/B		1989			.
A		1990			.
A		1991			.
.
.
.

Does anyone see how to achieve this?  I think it amounts to having the if
clause refer to other observation lines (namely, the lines with
coname=="A"). Thanks in advance for any suggestions.

-Terra 

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index