Sort dataset

It might be good to keep your dataset sorted, according to e.g. id number.

Just keep in mind:

  • For numeric variables, Stata interprets missing numeric values as being larger than any other number, so they are placed last when you sort.
  • When you sort on a string variable, however, null strings (empty strings) are placed first.
sort varname

For example:

sort id
More information
help sort