Saturday, March 18, 2006

st: Generating new variable from selected observations

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/


Tag:


Links to this post:

Create a Link



<< Home

This page is powered by Blogger. Isn't yours?