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: Normalize Variables by s.d. (programmatically)
From
daniel klein <[email protected]>
To
[email protected]
Subject
Re: st: Normalize Variables by s.d. (programmatically)
Date
Thu, 22 Dec 2011 15:42:19 +0100
Ryan,
If you already have created your dummies, you migth want to pass them
in an option. This way you do not need to identify the dummies in
<varlist>. Kit's program would then read
prog drop _all
prog stdize
syntax varlist(ts) [if] [in] [, dummies(varlist) *]
tsunab vl: `varlist'
marksample touse
tempvar rs
qui g `rs' = 0 if `touse'
foreach w of local vl {
qui replace `rs' = `rs' + `w' if `touse'
}
preserve
foreach w of local vl {
qui summ `w' if `touse' & !mi(`rs')
tempvar ww
qui g `ww' = `w' / r(sd) if `touse' & !mi(`rs')
loc neww: subinstr loc w "." "_"
rename `ww' _`neww'
loc vl2 "`vl2' _`neww'"
}
xtreg `vl2' `dummies', `options'
restore
end
Best
Daniel
*
* 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/