7 Listing and Sorting
7.1 Listing cases
To list data in the main results window you use the list command. If you type
list maths english
on the console, Stata will respond by listing all observations for those variables. If you don’t specify variables Stata uses all the variables.
7.2 Exercise
Type following line on the console
list maths class in 1/6
How would you describe the effect of the modifier in 1/6
7.3 Sorting
The most basic sort command in Stata is sort
. This command sorts on a list of variables (at least one) in ascending order. Run this code in the command window
sort sex maths
If you list the data now and scroll through the output, you will see it is sorted first by sex ascending and then by maths ascending. While useful, there is a more flexible command for sorting values.