Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: creating new variables


From   "Lachenbruch, Peter" <[email protected]>
To   "'[email protected]'" <[email protected]>
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: [email protected] [mailto:[email protected]] On Behalf Of Airey, David C
Sent: Thursday, January 27, 2011 5:08 PM
To: [email protected]
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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index