This is an admittedly general question but I've struggled to find the answer to it despite having looked at many places. From https://www.stata.com/support/faqs/d...ions-in-group/, the syntax of the code used is:
Code:
by eid (egenotype), sort: gen diff = egenotype[1] != egenotype[_N]
Code:
bysort eid: gen diff = egenotype[1] != egenotype[_N]
0 Response to -by- syntax of adding another variable in brackets
Post a Comment