Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Replacing missing values


From   "Dimitriy V. Masterov" <[email protected]>
To   [email protected]
Subject   Re: st: Replacing missing values
Date   Mon, 21 Aug 2006 11:20:47 -0400

I had to rename your variables to v1998-v2000, but this should do it:

forvalues v=1998/2000 {
	replace v`v'=v`v'[1] if v`v'==.
}

On 8/21/06, Ms. Marilyn Ibarra <[email protected]> wrote:
I have the following data:

Nace_ind        Industry     1998     1999  2000
c_d_e           Total        3.2       4.3   1.2
da12            Beverages    2.2       9.5   4.3
da13            Tobacco
da15            Textiles     2.1       4.9   6.5
dj12            Wood
dc43            Electrical   8.5       3.3   9.1
The first row are the variable names.  I would like to replace all missing values with the values of the first row (nace_ind=c_d_e and Industry=Total).  It would look like this:


Nace_ind        Industry     1998     1999  2000
c_d_e           Total        3.2       4.3   1.2
da12            Beverages    2.2       9.5   4.3
da13            Tobacco      3.2       4.3   1.2
da15            Textiles     2.1       4.9   6.5
dj12            Wood         3.2       4.3   1.2
dc43            Electrical   8.5       3.3   9.1

Thank you in advance,
Marilyn.





----------------------
Ms. Marilyn Ibarra
University of Georgia
Economics Department
503 Brooks Hall
706-340-2879
*
*   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/

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