I am having trouble standardizing to standardize some panel data from VDEM. The data doesn't seem to change much before and after I standardize. I thought that if I specified a mean of 0 and a standard deviation of 1, that the max of the new variable would be 1 and the min would -1, but that doesn't happen. The data is still kind of messy. For example, in one of my variables, the max before standardization is 3.882 and after it's 2.925161. And the min goes from -3.625 to -2.212299 . And the mean goes from -.3923272 to 2.65e-09. I'm assuming 2.65e-09 is close enough to 0. That doesn't seem very standard to me.
The code I am using is:
In general:
Code:
egen newvar = std(oldvar), mean(0) sd(1)
Code:
foreach variable in varlist { egen `variable'std = std(`variable'), mean(0) sd(1) sum `variable'std }
Thank you very much!
0 Response to How to standardize variables to make max value 1 and min value -1 ?
Post a Comment