Hey,
I´m trying to write a program, but I´m having some problems.
First of all I´m trying to store MEAN and SD in the return list, to revere to them later on, but I think they are not saved and I don´t understand why. Any suggestions?
secondly I´m generating a tempvar, which I than want to use for a calculation, but It just returns nothing. Can anyone see whats the problem?
program calculation, rclass
syntax varlist(min=1 numeric)
foreach var in `varlist' {
summarize `var'
return scalar MEAN = r(mean)
return scalar SD = r(sd)
tempvar generalized`var'
generate `generalized`var'' = ((`var' - return(Mean))/return(SD))
Thanks again!
I´m trying to write a program, but I´m having some problems.
First of all I´m trying to store MEAN and SD in the return list, to revere to them later on, but I think they are not saved and I don´t understand why. Any suggestions?
secondly I´m generating a tempvar, which I than want to use for a calculation, but It just returns nothing. Can anyone see whats the problem?
program calculation, rclass
syntax varlist(min=1 numeric)
foreach var in `varlist' {
summarize `var'
return scalar MEAN = r(mean)
return scalar SD = r(sd)
tempvar generalized`var'
generate `generalized`var'' = ((`var' - return(Mean))/return(SD))
Thanks again!