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" <[email protected]>
To   [email protected]
Subject   st: Generating new variable from selected observations
Date   Fri, 17 Mar 2006 16:00:21 -0800

Hello,
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.

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