How to install Stata user written ado files on the research servers

Installing user written ado files on the research servers

NOTE:  CCSS Research Support requires that each individual researcher follow the instructions below for installing ado files.

Q1:  When I try to download and install user written programs I get an “access denied” message. How can I use these?

Q2:  I am running Stata on a research server and I’m interested in using some commands that are not part of the main software. These commands are written by users and available to be installed into Stata through the web. The Stata reference manual makes this sound straightforward, but when I go through the steps on a research server, I can’t install the new command because I don’t have permission to add files to the space where the Stata code is kept on the server. How do I get around this?


It’s true that research server users do not have permissions to write to the default path for STB and other user-written files. However users can still install these files to their U drive. Sample code for installing “reghdfe” package provided under “Example” section.

First, from within Stata you can issue the command “sysdir” to see the list of the system set directories, to which Stata points to by default.  Included in the list of default settings are these entries:

PLUS: C:\ado\plus
PERSONAL: C:\ado\personal

The PLUS folder is the destination for downloaded ado files written by other users.  The PERSONAL folder is intended for ado files you have written.  CCSS-RS computing account users do not have permission to write to the C:\ drive so there are other options:  If you need to use an ado file you can install it yourself by redirecting the PLUS folder to your U drive (as shown below).   To install user written ado files (anytime) you’ll need to use  the “sysdir set” commands (case is important) to redirect the PERSONAL or PLUS folders as shown below:

sysdir set PLUS "U:\folder"
sysdir set PERSONAL "U:\folder"

where “folder” is the subfolder you wish to save your ado files in (you must create this first). This location used in “sysdir set” command must be the same as your current working directory location and the same location as where all the files you are working on.


You may copy and paste most of the commands below. Know that for this example I have a folder in my documents named “Statafiles”

sysdir set PLUS "U:\Documents\Statafiles"
sysdir set PERSONAL "U:\Documents\Statafiles"
*Green text is a comment. Set directory to same location set for PLUS directory. This is also the place where all your Stata working files are saved.
cd "U:\Documents\Statafiles"
*Use option below if you know the name of the ado file you wish to use
ssc install reghdfe
*May need to use option below if you do not know exact name of ado file. Search features/commands of ado you want
search reghdfe
*After search command above, a new window will pop-up with options to download packages that fit search criteria.
*Click on the package name you would like to install. You will be directed to another page. Scroll down to the section "Installation Files", select "(click here to install)". Package will be installed to location you set as PLUS or PERSONAL directory


To make this a “permanent” change do this:

Create a shortcut to the Stata application on your desktop (Start → All Programs → right-click on Stata17 → More → Open File Location → Right-click on StataMP 17(64-bit) → “send to” → Desktop(create shortcut)).  Then find the newly created shortcut on your desktop, right click on the icon and choose “properties” → “Shortcut” tab.  In the “Start In” field enter the path “U:\Documents”. In “Target” field enter “C:\Program Files\Stata17\StataMP-64.exe” only. If you see other text in this field delete it, you may see “/UseRegistryStartin” within the Target field, delete that.  Use the Stata do file editor to create a file called “” file which contains the sysdir commands you wish to use.  Be sure to place the file in the directory “U:\Documents”.  Stata will automatically look for the file when opening and run those commands.