Common Stata Settings Using the Set Command

Stata has a collection of settings that can be applied using the set prefix command in the Command pane. This allows you to alter many of Stata’s default settings with regards to analysis. A short description of some of the more commonly used settings is shown below, along with how you apply the setting using commands. For settings that are turned on or off you simply add on or off to the command. For example - set graphics on or set graphics off. If you are looking for a setting not listed here, check out the help file using the command help set.


This allows you to set the maximum number of kilobytes that automatically loaded do-files may consume. The default is 1000 kilobytes. If you have a do-file you want Stata to hold in memory that is larger than 1000 kilobytes you use the command as follows:


This command is for Windows operating systems only. It allows you to set whether multiple graphs will open in tabs in the same window, or in completely separate windows. The default is off, which means they will open in separate windows. To change this to on (graphs open in tabs instead), use the command as follows:


Double buffering prevents windows from flickering when they are redrawn or resized. The default for this setting is on. If you have problems with results output being slow to load, you should try turning this off. To turn it off, use the following command:


This sets the style of a decimal point, either comma or period. The default is a period. To change this to a comma, use the following command:


This controls what Stata does with empty cells. The default is to keep empty cells. To change this to drop empty cells, use the following command:


This controls whether Stata prints graphs. The default for this setting is on. When I am exporting a whole bunch of graphs I usually turn this off because it improves Stata’s processing time. To turn this off:

NOTE: Don't forget to set graphics on at the end of a session, or Stata won't show you any graphs you make in the next session!


This setting allows you to change the default confidence interval. Stata’s default is for a level of 95, which is equivalent to a p-value of 0.05. To change the confidence level to a chosen p-value, use the number 100–pvalue. For example, to change to a 0.1 p-value, use the following command:


This setting will change the space between lines. You must specify the number of pixels you would like between lines. The default changes depending on your operating system and font choices. You can also change this setting using the menus.

For Windows – Edit > Preferences… > General preferences…

For Mac – Preferences > General preferences…

To set this using the command window, use the following command:


This setting is used to specify the screen width, in characters, for log file output. For the Results pane, the screen width will adjust when you make the pane bigger or smaller. To set your linesize, use the command:


This setting controls whether a log is opened in smcl or text format. The default for a full log is smcl, and command logs can only be opened in text. To change this setting, specify either smcl or text in the following command:


This controls the number of dialog boxes whose contents are remembered for the duration of a session. The default is for the content of the first 50 different dialog boxes to be remembered. To change this setting, use the following command:


This setting controls whether Stata will pause output, display —more— and wait for a key to be pressed. The default for this setting is off, so Stata does not normally pause for a more message. To turn this on, use the following command:


This setting is commonly used when creating dummy datasets to test commands or analyses. If you are creating a new dataset you will need to set the number of observations before you start creating variables. Give the number of observations you would like in your dataset when using this setting. To set the number of observations, use the command:


This setting is only available to Stata/MP licences. This allows you to change the number of processors Stata uses, within the bounds of your current licence. For example, if you have an MP4 licence you can set the number of processors to be used to 1; 2; 3; or 4, but not 5 because you have only purchased MP4. The default setting will be either the number of processors available on the computer, or the number of processors you have purchased, whichever is less. To change this setting use the following command:


This sets the maximum number of commands stored by the History pane (previously called the Review pane). It can store up to 32,000 commands, and the default is to store 5,000. To change the number of commands stored, use the following command:


This setting controls which graph scheme is used to draw and colour graphs. A scheme contains many different graph settings that will be used as default settings by Stata. It allows you to control the look of your graphs without having to constantly edit each graph you create. Stata has several scheme files loaded, and you can also either make your own scheme file or download a scheme file made by someone else. To change the scheme file used, make sure the scheme file is saved in your personal ado filepath. For example, I have a scheme called schemeLaura which is saved in my personal adopath, and to set the scheme for use in Stata I use the following command:


Use this setting to set the random seed number used for subsequent RNG (random number generator) commands. You should always set the seed before running a set of commands using RNG, so the results you get are reproducible by others. To set your seed, use the following command:


This setting is Stata’s debugging command. If you set trace to on, Stata will print all of the behind-the-scenes computations to the Results screen. This setting is most commonly turned on when you are investigating a non-specific error that Stata has given you; or if you are debugging a user-written/personally-written program. Do not turn this on if you do not know what you are doing, or if you are trying to debug a very long program script. This gives a lot of output to the Results screen, and it can significantly increase the time Stata takes to complete. If you have a very long program that takes days to complete and you are trying to debug, please cut down the program into smaller manageable segments to test with trace. Additionally, make sure to have a log saving the output before you run anything through trace. There is usually too much output for the Results screen to handle and it will overwrite earlier output with later output. Finally, make sure to turn trace back off when you are finished. To turn it on:

and to turn in off:


This setting controls the default storage type for new variables (e.g. those created with generate). You can choose from byte, int, long, float, double, and str#. To set the type you will need to specify one of those types just listed in the command. For a str default you will also need to give the number of characters (by byte size) for the string, which will be a number between 1 and 2,045. Put this number where the # is shown in the above list. To change the default type, use the following command and replace type_name with one of the types from the list in bold:


These are the most commonly used settings. For a full list of Stata settings check out the help file with the following command:

500 views0 comments

Recent Posts

See All