Statalist The Stata Listserver


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

st: RE: replace missing values (fwd)


From   "Rodrigo Martell" <rodrigo.martell@frontier-economics.com.au>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: replace missing values (fwd)
Date   Mon, 16 Oct 2006 13:58:11 +1000

Try this (?)

replace  Total_Score =  avg if  Total_Score==.

avg is meant to be the average of the 3 units you've already worked out.

I hope that helps.



Rodrigo Martell

 <http://www.frontier-economics.com> 	
Frontier Economics Pty. Ltd.
395 Collins Street
Melbourne VIC 3000
Australia
www.frontier-economics.com 	
switch:
direct:
fax:
mobile:
email:


+61 (0)3 9620 4488
+61 (0)3 9613 1518
+61 (0)3 8614 2711
+61 (0)407 909 811
rodrigo.martell@frontier-economics.com <mailto:rodrigo.martell@frontier-economics.com> 


This e-mail, including any attachments, may contain confidential and privileged information for the sole use of the intended recipient(s). Any review, use, disclosure or distribution by others is strictly prohibited. If you are not the intended recipient (or authorised to receive information for the recipient), please contact the sender by reply e-mail and delete all copies of this message. Thank you.

	



-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu]On Behalf Of Cathy L.
Antonakos
Sent: Monday, 16 October 2006 1:51 PM
To: statalist@hsphsun2.harvard.edu
Subject: st: replace missing values (fwd)


Sending again with a formatting correction, to hopefully display the data correctly this time.
CA

--------------------

I have a dataset with hospital and ICU data. I'd like to replace missing data 
for one ICU with the average value of the other 3 icu's at that hospital. The 
dataset looks like this:

Unit_ID  Total_Score
11       . 
12       90
13       60
14       27

I can get the average for total score for the 3 units by using "if" and 
specifying the unit id's. But how can I then replace the missing unit's score 
with the average from the 3 other units? I've tried several ways and searched 
online but can't find an answer to this specific problem. Thanks for any help 
you can provide.
Cathy


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