Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | "Lachenbruch, Peter" <Peter.Lachenbruch@oregonstate.edu> |
To | "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu> |
Subject | RE: st: creating new variables |
Date | Fri, 28 Jan 2011 08:19:46 -0800 |
If you know the total, do you need to create hits and misses separately? Isn't misses=n-hits? Tony Peter A. Lachenbruch Department of Public Health Oregon State University Corvallis, OR 97330 Phone: 541-737-3832 FAX: 541-737-4001 -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Airey, David C Sent: Thursday, January 27, 2011 5:08 PM To: statalist@hsphsun2.harvard.edu Subject: re: st: creating new variables . How about... *make data like yours clear set obs 500 gen participant = _n forvalues i=1/10 { gen r`i' = runiform() < 0.5 gen w`i' = runiform() < 0.5 } *create hit and miss totals egen rhit = rowtotal(r*) egen whit = rowtotal(w*) gen rmiss = 10-rhit gen wmiss = 10-whit * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/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/statalist/faq * http://www.ats.ucla.edu/stat/stata/