Statalist The Stata Listserver

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

st: Generating new variable from selected observations

From   "Julian Jiro Wimbush" <>
Subject   st: Generating new variable from selected observations
Date   Fri, 17 Mar 2006 16:00:21 -0800

I'm trying to adjudicate one observation that has two sets of responses by taking the mean for all
my variablers in the two sets of responses and using those means as the data.

More specifically: each observation is a medical center, and one medical center sent in two
completed surveys (two different people in the org somehow responded), and I simply want what is
currently coded incorrectly as two medical center observations to be one medical center
observation, basically by taking the means of two sets of responses for all my variables.  So I
started writing some code like this:

for variable1-variable200: ltype(numeric): replace @=(@[14]+@[27])/2, if id==14 or id==27

and then simply dropping observation 27, but it didn't work. (I was trying to specify observation
14 and 27 in the replace part, but I think I've done something completely different.)

I have a feeling I may well be completely on the wrong track, but any help would be appreciated!
 Thanks in advance.

*   For searches and help try:

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