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]

AW: st: sort of standardization

From   "Martin Weiss" <>
To   <>
Subject   AW: st: sort of standardization
Date   Wed, 12 May 2010 16:46:38 +0200


" local range=r(max)-r(min)+1"

Rich, what does the "+1" term do for the "range"? I took the definition in
my code from [R], page 204. Am I missing anything?


-----Ursprüngliche Nachricht-----
[] Im Auftrag von Richard
Gesendet: Mittwoch, 12. Mai 2010 16:40
Cc: Ginevra Biino
Betreff: Re: st: sort of standardization

if I understand correctly what you want, I would do the following within
a -foreach- loop:

summarize variable
calculate the range from r(min) and r(max)
divide the old variable by this calculated range inside a -gen-


foreach var of varlist .... {
qui su `var'
local range=r(max)-r(min)+1
gen `var'3=`var'/`range'


On 5/12/10 10:29 AM, Ginevra Biino wrote:
> Dear Statalist,
> I have to standardize many variables (in order to run PCA).
> Besides generating the n corresponding std(varname) vars, which I have
> already done, I also want to generate n new  variables obtained dividing
> each variable by its range. Can anybody help me?
> Ginevra
*   For searches and help try:

*   For searches and help try:

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