Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Rescaling variables


From   <suryadipta.roy@lawrence.edu>
To   statalist@hsphsun2.harvard.edu
Subject   st: Rescaling variables
Date   Mon, 07 Aug 2006 23:14:43 -0500

Hi,

I had another question on rescaling variables. At this point, I am trying to convert my some of my independent variables (running from 0 to 6) to standard normal variables. I have been able to do it by subtracting the numbers from the mean and dividing by the standard deviation for each group (I have an unbalanced panel of countries), but the problem comes for countries which had no within variation for that variable, since dividing by zero is giving missing observations in such cases. The following command does not work:

by code, sort: egen newvar=std(oldvar), since egen does not work with by.

Can anyone point me towards the correct command for direct conversion of numbers into their standard normals thereby circumventing the problem of dividing by zeros? Thanks as usual!

Suryadipta.


Suryadipta Roy, Ph.D.
Visiting Assistant Professor,
Department of Economics,
Lawrence University,
115 South Drew Street,
Appleton, WI-54911.
Phone: 920-832-7343.
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/




© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index