Statalist


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

Re: st: replacing some values in column A by the values from column B


From   David Airey <david.airey@Vanderbilt.Edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: replacing some values in column A by the values from column B
Date   Tue, 5 Feb 2008 12:03:53 -0600

.

clear
input materials costmater
1 1
0 5
. 4
-1 6
end

list
replace materials = costmater if missing(materials) | materials < 0
list

On Feb 5, 2008, at 11:47 AM, Oliinik, Victoria wrote:

Dear statalisters,

Does anyone know whether (and how) I can get Stata to do the following:

I have a variable "materials" which contains a lot of missing and
negative values. Where values are missing, or negative, I want Stata to
take corresponding values from a variable "costmater" and replace them
in the column "materials".

Thanks
Victoria



======================================================
LICOS Centre for Institutions and Economic Performance
Katholieke Universiteit Leuven
Deberiotstraat 34 - bus 3511, B-3000 Leuven, Belgium

Office: 03.21
ph ++32 (0)16 32 65 66
fax ++32 (0)16 32 65 99
Website: http://www.econ.kuleuven.be/licos/



Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm


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