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" <>
To   <>
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

Frontier Economics Pty. Ltd.
395 Collins Street
Melbourne VIC 3000

+61 (0)3 9620 4488
+61 (0)3 9613 1518
+61 (0)3 8614 2711
+61 (0)407 909 811 <> 

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-----
[]On Behalf Of Cathy L.
Sent: Monday, 16 October 2006 1:51 PM
Subject: st: replace missing values (fwd)

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


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.

*   For searches and help try:

*   For searches and help try:

© Copyright 1996–2022 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index