Gsort Stata. You cannot use this option with gsort b. If there are 2 variables var1 and var2 after sort stata will sort the observations according to var1 first.
To remedy this problem gsort s generate option will create a new grouping variable that is in ascending order thus satisfying stata s narrow definition and that is in terms of the groups it defines identical to that of the true sort variables. Sort varlist if varlist is only one variable then stata will sort the observations in ascending order based on that variable. If there are 2 variables var1 and var2 after sort stata will sort the observations according to var1 first.
Use the option stable to make sure stata uses the same randomization every time i.
Stata complains because it does not understand descending sorts gsort is an ado file. The preferred method is to specify a combination of variables that uniquely identifies your observations. Assume you have sorted your data by country and within country by region. To remedy this problem gsort s generate option will create a new grouping variable that is in ascending order thus satisfying stata s narrow definition and that is in terms of the groups it defines identical to that of the true sort variables.
