Common mistakes
As you start working with stata, you will likely face many error messages. Don’t let this discourage you and use the following hints to find your errors quickly.
-
Check the spelling of your command:
- if the command is displayed in blue in the dofile, stata recognizes it as a command, otherwise there is likely a typo
- if the command is recognized, but returns an error, look up the helpfile
- Check the spelling of the input variables from your dataset, for example by comparing it with the variables window in the user interface
- Don’t forget the comma “,” before specifying any options
- If you want to use an equality condition, use “==” instead of “=”
- When importing data, make sure the workspace is cleared by using the option “, clear” or the command “clear all” before importing
- When saving a dataset, don’t forget the “replace” option
- Note the difference between ` (accent) and ‘ (apostrophe)
- Check if all the parentheses, quotation marks etc. that are opened are also closed
- Click on the error code that is displayed in the results window, sometimes the description gives you an idea of where to look for your mistake. Sometimes the description is very general though.
If you cannot find the mistake on your own, check the “getting help” chapter: