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

st: referencing a specific cell


From   "Paley, Irina" <[email protected]>
To   <[email protected]>
Subject   st: referencing a specific cell
Date   Tue, 6 Dec 2005 20:42:59 -0500

Hello Stata Listservers,

Could anyone give me any advise? I would really appreciate it!

Suppose my data has 2 observations per household and is organized as:

household_id	wage of person1		wage of person2
1			3			.			
1			5			.				

2			6			.						
2			7			.			

I would like Stata to, whenever the wage of person 2 is missing, to substitute into it the SECOND observation of the wage of person 1 within that household. So I would want the data to look like:

household id	wage of person1		wage of person2
1			3			5
1			5			5

2			6			7
2			7			7

How would you do that?

The following command (with the numbers is brackets referencing the observation number within the household) doesn't work, since stata interprets things in brackets as weights:

by household_id: replace wage2[1]=wage1[2]


Thanks so much for any help you can provide!


Irina Paley


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