Hello everyone,
I have a question regarding the "out-of-date" command "for var...".
I've been using it recently and I'm wondering if there's a risk of getting wrong results if I use it instead of the new version of the command.
It seems much more convenient than the "foreach var" command.
Example:
--------------------------------------------------------------------------------------------------------------------
"out-of-date"
for var sexe est_nais: bysort code_enfant: egen tp_X=nvals(X)
"new version"
foreach var of varlist sexe est_nais {
bysort code_enfant: egen tp_`var'=nvals(`var')
}
--------------------------------------------------------------------------------------------------------------------
I have the same result here. But can it in some cases distort my results?
Thanks,
Christophe
I have a question regarding the "out-of-date" command "for var...".
I've been using it recently and I'm wondering if there's a risk of getting wrong results if I use it instead of the new version of the command.
It seems much more convenient than the "foreach var" command.
Example:
--------------------------------------------------------------------------------------------------------------------
"out-of-date"
for var sexe est_nais: bysort code_enfant: egen tp_X=nvals(X)
"new version"
foreach var of varlist sexe est_nais {
bysort code_enfant: egen tp_`var'=nvals(`var')
}
--------------------------------------------------------------------------------------------------------------------
I have the same result here. But can it in some cases distort my results?
Thanks,
Christophe
Comment