Bookmark and Share

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

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

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

From   Austin Nichols <>
Subject   Re: st: Normalize Variables by s.d. (programmatically)
Date   Wed, 21 Dec 2011 16:49:56 -0500

Ryan Turner <>:
help regress
(see option beta) or

On Wed, Dec 21, 2011 at 3:46 PM, Ryan Turner <> wrote:
> Hi all,
> I want to normalize each variable in my regressions by its own standard deviation.  Simple enough, but I have a lot of variables and a lot of regressions, so I would like to do this programmatically to simplify the code and avoid mistakes.  Further, the data have many missing records and most of the time the number of observations are different for each regression; therefore I need to calculate a variable's standard deviation over the subset of records included in that particular regression.
> I have been searching for three days for a simple way to do this, and, finding none, have spent significant time writing a program "doreg" which takes a varlist to regress on, backs up that varlist, creates a rule to determine what records would be included in the regression (e.g. if !missing(varlist)), and for each variable in varlist, it calculates the s.d. given that rule and replaces the original variable with the normalized value (divide by standard deviation).  I more or less got it working, but the program is plagued by special cases; dummy variables, difference operators, wildcards.  When my program devolved into manually parsing wildcards I knew it was time to ask for help.
> So, what is the proper way to accomplish my goal?  Do I just need to get my program working, or is there some other fundamentally better way to do it?  I have included my program doreg for reference but really I am looking for a higher level response.

*   For searches and help try:

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