### Tips on customizing Stata 8.x for lab managers running Windows

These pages contains tips for lab managers on how to customize Stata for windows.

While we have tried to create instructions here that are general and flexible, we recognize that each lab is unique and may require special configuration.  We would be very happy to sit down with you and install and customize Stata together, and then test it out.  Please contact the ATS Stat Consulting Group at and we can arrange to meet with you.

1. Decide how you want to configure the Stata directories

Stata has a number of different directories, some of which that probably should be read only for ordinary users, and some of which should be read/write.  Here is a description of the directories that Stata uses, what they contain, and how we would suggest configuring them.

<STATA> Where Stata is installed.
<SITE> Where sitewide add-on files are stored.
We recommend the <Stata> and <SITE> directories be read only.  Also, since these directories are where add-ons and updates are stored, placing this on a server could ease your update process.  By updating the files on the server, Stata could be updated for all the machines in your lab.

<Startup> The Startup directory, the directory where the user will be placed after starting Stata.  This is where data would be stored if the user does not change directories.
<PERSONAL> Where users can store their own add-on files.
We recommend the <Startup>, <PLUS> and <PERSONAL> directories be read/write. (See footnote #1 if it is not possible to make these directories read/write).

For example, you may have Stata on a network drive called Z: and you may want the directories to be configured as

<Stata>    Z:\Stata
<PLUS>     C:\StataAdo\Stbplus

Based on this hypothetical example, when we refer to the <Stata> directory, we would be referring to the Z:\Stata directory.  You would replace this with the directory you have chosen for your installation.

2. Install Stata (if you have not done so already)

When you install Stata, it will ask you where you want the Stata executable to be stored, and you can tell it to install Stata in the directory you have chosen as the <Stata>.  Likewise, it will ask you for the directory to be the data directory, and you can tell Stata the directory you have chosen as the <Startup> directory.  You can change the <Startup> directory later in the configuration step if you should change your mind about this location, or if you have already installed Stata.

3. Create any needed directories.

From the directories you listed in part #1, see if they all exist.  If any of those directories do not exist, create them.

4. Configure Stata directories

4a. Create profile.do
In the <Stata> directory, create a text file called profile.do   This file will be run every time you start Stata.  You can use this to tell Stata how you want the directories configured.  Say that you use the example directories shown above in Step 1, you would then  make the file profile.do look like that shown below.  You can omit the lines that start with a * because these are comments.
----------------- begin profile.do -----------------------
* Set Startup Directory

* Set SITE, PERSONAL and PLUS directory

* set order directories are searched

* Set Size of largest data file Stata can read.
set memory 20m
----------------- end profile.do --------------------------

- The cd command is used to set the starting directory.
- The sysdir commands are used to tell Stata the directories to use for the SITE, PERSONAL, and PLUS files.
- The global S_ADO command tells Stata the order in which to search those directories for files (for more information on this, see Footnote #2 below).
- The set memory command is used to tell Stata the largest data file that it can read into memory.  By default, Stata only allocates one megabyte for data, which can easily be exceeded.  Choose a value that makes sense for you.  The user can override this by issuing the set memory command themselves.
- Save the file profile.do in your <STATA> directory.

4b. Test the Settings from profile.do
Try starting Stata and check to see if your settings from profile.do took effect.
- Try typing pwd and check to make sure that Stata says you are in the directory you specified as the <Startup> directory.
- Type sysdir and check that the paths Stata labels as SITE, PERSONAL and PLUS are the same as the ones you specified.
- Type adopath and check the order of the files.  They should be listed in the same order as you mentioned in the global S_ADO command.
- Type memory and check to see that Stata has allocated the amount of memory you specified.

5. Update Stata

Stata updates its software very frequently and they make it very simple to update Stata from within Stata.  Because Stata has so many updates, it is very important to update Stata soon after installing it to make the new features available.

• Start Stata as the system person who can write into the <Stata> directory.
• Type
set more off
• Then type
update all

and this will contact the Stata web site and download the most current version of Stata.  This includes updates to .ado files and the Stata executable.  If the Stata executable is updated, you then need to type
update swap

• Start Stata as the system person who can write everywhere
• Type net set ado SITE
• Type the following commands

This will copy the ATS resarch tools, ATS teaching tools, and ATS utility tools to your <SITE> directory where they will be available to all of your users. You can learn more about the features these programs offer you by visiting Useful Stata Programs.

It is recommended that you update the Additional .ado Files once a quarter.

6. Set up Shortcuts etc...

Stata should now be configured, updated, and ready for your users.  You can choose how you provide shortcuts to your users to get to Stata.

We would be grateful if you included a shortcut right next to the Stata shortcut, say called
ATS  Stata Web Resources at UCLA
ATS Stata Class Notes and Movies
Stata Corp. User Support  and link that to http://www.stata.com/support/ to help direct people to the great support that Stata has at its web site.

7. Testing the Installation

You can do the following to test the installation. Start Stata as a regular user and try the following.

• Test the settings as described in Step 4b.
• Test the ATS add on programs
use http://www.ats.ucla.edu/stat/stata/notes/hsb2
• Test an ATS teaching tool by typing
ssc install pairplot
and it should install without error. You can test it like this
use http://www.ats.ucla.edu/stat/stata/notes/hsb2
• You can check to see that pairplot was really downloaded to the <PLUS> directory by looking in that directory to see if there is a directory called p and inside of that pairplot.do pairplot.hlp .

If you should need more assistance setting up Stata for your lab, please contact the ATS Stat Consulting Group at and we can arrange to meet with you.

Footnote #1.
If it is not possible for users to write to the <Startup>, <PLUS> and <PERSONAL> directories, we can work with you to create instructions for your users for using Stata even though they cannot write to some of these directories.

Footnote #2.
We have taken the Stata default and made a minor change in S_ADO, placing the SITE directory after PLUS (instead of after BASE).  This means the add-on files that users download would be used instead of a file with the same name in the SITE directory.  We believe this is a good modification because if users wish to update add-on files that happen to be in the SITE directory, their add-ons (which may be more up to date) would be used instead of those in the SITE directory.  We believe this reduces the burden on lab managers to frequently update the Stata add-on programs for the users.  Since the users can easily make these updates themselves.  Otherwise, using the Stata defaults, the lab manager would need to update the files in the SITE directory to make new add-ons available to users.  By allowing users to make these updates, we believe this can reduce the work for the lab manager.  However, the one drawback is that the updates are probably stored on the local computer, so some of the computers may have updates that others do not have.

The content of this web site should not be construed as an endorsement of any particular web site, book, or software product by the University of California.