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

st: simple replace


From   "Terra Curtis" <[email protected]>
To   <[email protected]>
Subject   st: simple replace
Date   Mon, 5 Dec 2005 14:28:20 -0500

Dear Statalisters,

I think what I have is a simple logic question involving replace.  I can't
seem to find a related question in the list archive.

I have data which looks something like:

x	y	z
-	-	-
A		A
A		A
A	B	A
A	B	A
	B	B
	B	B

I want 'z' to be all "A"s but this involves replacing 'z' with a value of
'x' which is found on a different observation line.  The problem is that the
amount of times 'x' and 'y' overlap throughout the dataset is not
consistent, and therefore I cannot use the x[_n-1] syntax for replacing.  I
think I could use a for-loop but I'm not sure.  Does anyone see how to go
about this?

Thanks very much,
Terra Curtis

*
*   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