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
"Airey, David C" <[email protected]>
To
"[email protected]" <[email protected]>
Subject
re: st: creating new variables
Date
Thu, 27 Jan 2011 19:08:08 -0600
.
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/