Installing user written ado files on the research servers
NOTE: CISER 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:
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. CISER Research Computing users do not have permission to write to the C:\ drive so there are other options: If you need to use an ado file during off hours you can install it yourself by redirecting the PLUS folder to your home directory (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 folder 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 must be the same as your current working directory location and the same location as where all the files you are working on are in.
You may copy and paste most of the command below. Know that for this example I have a folder in my documents named ”
sysdir set PLUS "U:\Documents\Statafiles"
sysdir set PERSONAL "U:\Documents\Statafiles"
*Set directory to same location set for PLUS directory. This is also the place where all your Stata working files are saved.
*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
*THIS IS A COMMENT. 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 Stata10 → choose "send to" → Desktop). Then find the newly created shortcut on your desktop, right click on the icon and choose "properties". In the "Start In" field enter the path "U:\My Documents". Use the Stata do file editor to create a file called "profile.do" file which contains the sysdir commands you wish to use. Be sure to place the profile.do file in the directory "U:\My Documents". Stata will automatically look for the profile.do file when opening and run those commands.