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

Re: st: Averages for missing values

From   Richard Williams <>
Subject   Re: st: Averages for missing values
Date   Thu, 08 Sep 2005 17:28:18 -0500

At 03:45 PM 9/8/2005, TinnaLaufey Asgeirsdottir wrote:
Hello Statalist.

Before I give myself carpal tunnel syndrome I might ask:

Is there a command to replace missing values with averages?

What I am currently doing is:

generate varnameAVE=varname
summarize varnameAVE
replace varnameAVE=[here I use the mouse to copy from the results
window to the command window] if varnameAVE==.
Adding to your list of suggestions: try the -impute- command, e.g.

gen one = 1
impute varname one, gen(varnameAVE)

For other variations (e.g. subgroup means) see p. 10 and later of

Let me add that this may be showing you how to do evil, however; most of these sorts of methods are now frowned upon. See Paul Allison's Sage book entitled "Missing Data". You may wish to check out Patrick Royston's -ice- package, which is also discussed in Stata Journal, V. 5 # 2, pp. 188-201.

Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
FAX: (574)288-4373
HOME: (574)289-5227
EMAIL: Richard.A.Williams.5@ND.Edu
WWW (personal):
WWW (department):
* For searches and help try:

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