Saturday, June 27, 2020

Variation within a group

Hello
To detect if the value of a numeric variable var_num changed within a group var_cat, I do this:

bysort var_cat: egen sd = sd(var_num)
replace sd = 1 if sd > 0 & sd != .
tab sd, m


Are there any command that execute this function? In the example, to create a variable like "sd"

Thanks

No comments:

Post a Comment