Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | "Sarah Edgington" <sedging@ucla.edu> |
To | <statalist@hsphsun2.harvard.edu> |
Subject | st: RE: Generating New variable for best measurement |
Date | Thu, 2 Jan 2014 17:50:55 -0800 |
What do you mean by "best of the four measurements"? If by best you mean highest then you should be able to get what you want with: gen varbest=max(var001,var002,var003,var004) This will work assuming that each individual is represented by a single observation. If not, you'll need to give more details of what your data look like. -Sarah -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Witness Chirinda Sent: Thursday, January 02, 2014 5:42 PM To: statalist@hsphsun2.harvard.edu Subject: st: Generating New variable for best measurement Dear All, I have measurements of a test taken at four different times. i.e (var001, var002, var003 and var004). I want to generate a new variable (varBest) which takes the best of the four measurements for each individual. Any advice on how to go about this would be greatly appreciated Thanks! * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/ * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/