Hello! i need to run a reggresion with a variable that is in percentiles, i tried with foreach x for variable and also tried standarized it but it wont work. This is a variable p311t1 of the total spending in a household:
type: numeric (long)
range: [2,10000] units: 1
unique values: 226 missing .: 581,181/581,717
mean: 661.39
std. dev: 1067.87
percentiles: 10% 25% 50% 75% 90%
40 100 300 720 1500
here is the code:
please leave your suggestions, thank you
type: numeric (long)
range: [2,10000] units: 1
unique values: 226 missing .: 581,181/581,717
mean: 661.39
std. dev: 1067.87
percentiles: 10% 25% 50% 75% 90%
40 100 300 720 1500
here is the code:
Code:
foreach v in p311t1{
summ `v'
gen gast_`v'= (`v'-r(mean))/r(sd)
}
d gast_
egen gasto = rowtotal(gast_)
summ gasto
gen gasto_ = (gasto-r(mean))/r(sd)
sum gasto_

Comment