top of page

The profile and sysprofile Do-Files – Automating Your Stata Start-Up

Stata allows you to create a special “profile” do-file that it will run every time you start the program. This do-file can contain any Stata commands that you always want to run when Stata first opens. For example, I have put in commands to open a log file and save it in a specific location whenever I open Stata. This is useful because it means everything I do in Stata is always logged, and if I am trying to re-create something I have done in a previous session I can just look everything up in the log file. I also have a command that sets the current working directory to a specific folder on my computer, rather than the default of my documents folder.

There are two different types of “profile” do-files – the “” or the “”. Commonly the “” is placed in your home directory (e.g. C:/Users/Laura), and the “” is placed in the Stata folder (e.g. C:/Program Files/Stata17). However, you can place both these files in any of the following places:

  • Your home directory – e.g. C:/Users/Laura

  • The Stata installation folder – e.g. C:/Program Files/Stata17

  • The current working directory

  • Along your user path

  • Along the ado-path


This file is where you put all your own personal settings. For example setting up a personal log, or changing the default working directory to a particular folder. Any and all commands that you want Stata to run at the start of every session should go here. Below is an image of my personal “” as an example:


This file is for system administrators who run a Stata network or site licence. This is where administrators will put any commands that they want to run every time Stata is opened by anyone with access to the network or site licence. For example, administrators may want to change the path of some of Stata’s system directories. You might want the personal system directory be shared across the network so that everyone is working off the same user-written commands to keep version consistency.


It is important to note that Stata will always run the “” first, before running an individual’s “”. If you are making changes in your “” like setting a particular scheme or working directory to make it uniform, these will be overridden if the individual’s “” contains another version of the same command. For example, if you set the working directory to be on a server in the “” but in the individual’s “” they also set their working directory to be in their documents folder, then the working directory will be the documents folder not the server. To avoid this, it is important to make sure the individuals using your network know what settings they can or cannot change in their “”.

1,170 views0 comments

Recent Posts

See All
bottom of page