Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

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

Re: st: Normalize Variables by s.d. (programmatically)

From   daniel klein <>
Subject   Re: st: Normalize Variables by s.d. (programmatically)
Date   Thu, 22 Dec 2011 15:42:19 +0100


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'
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'

*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index