Dear Stata Users,
I run the following 2 commands:
gsort var1 var2 -var3
by var1 var2 -var3: gen n=_n
Now stata tells me that the data are not sorted so I can't generate _n (I guess it doesn't get the minus of the gsort command before).
My question is now wheter there still is a possibility to generate _n with var3 beeing sorted in descending order? (so var3 descending while n ascending)
Thank you!
I run the following 2 commands:
gsort var1 var2 -var3
by var1 var2 -var3: gen n=_n
Now stata tells me that the data are not sorted so I can't generate _n (I guess it doesn't get the minus of the gsort command before).
My question is now wheter there still is a possibility to generate _n with var3 beeing sorted in descending order? (so var3 descending while n ascending)
Thank you!
Comment