This FAQ illustrates the nmissing and npresent commands which show you the number of missing, and number of non-missing values for your variables. The nmissing and npresent commands were written by Nicholas J. Cox and you can download them using search nmissing (see How can I use the search command to search for programs and get additional help? for more information about using search).
Let’s illustrate use of the nmissing and npresent commands using the high school and beyond data file we use in our Stata Classes.
use https://stats.idre.ucla.edu/stat/stata/notes/hsb1, clear (highschool and beyond (200 cases))
The nmissing command shows us that one of the variables, science, has missing data, and it has 5 missing values. By contrast, the npresent command shows us the number of non-missing values for all of the variables in our data file. From this, we see all of the variables have 200 non-missing observations, except for science that has 195 non-missing observations.
nmissing science 5 npresent id 200 gender 200 race 200 ses 200 schtyp 200 prog 200 read 200 write 200 math 200 science 195 socst 200
For More Information