How to Fix Missing Observations in STATA

This article notes a technical problem that STATA noobs like myself may run into where it looks like STAT is failing to import certain variables or observations properly.

A big thanks to Joshua Ingber who solved this issue for me.

This article will solve a particular case of missing observations, not the general case. The general case could originate in a number of ways.

Problem description:

  1. Import delimited data into STAT
  2. STATA reports that it imported the variable, but when you enter “sum myvariablename”, STATA states that there are 0 observations.
  3. Use the toolbar at the top of the STATA GUI and open the data browser by clicking Data -> Data Editor -> Data Editor (Browse)
  4. Notice that the data appears in the browser even though it is not reported using “sum”

What’s really going on?

The issue is that your numerical data was interpreted by STATA as a string. We need to tell STATA that the variable is numerical by running the following:

“destring myVariableName, gen(myNewVariableName)”

Problem solved! Now sum works:


  • 1

Leave a Comment