Stata has a range of extensions (plugins) available. Most people install these plugins from within Stata using the ‘net install’ command. This requires Stata to connect to an external website. However, in the datalab environment you are not able to connect to external websites. Therefore, if you want to install a Stata plugin you will need to do it manually.
Below are two methods for manually installing a Stata plugin. If all of your files are organised correctly and have the correct extension names (eg if you have copied them from another machine where they are correctly installed), the first method should work. If the first method fails, try the second.
1. Get a copy of the plugin files put into your datalab folder. To do this you will have to download the files from a website or from another computer that has the Stata package installed. Make sure you copy all of the files that might be relevant, including .hlp and .tco files. Then contact the microdata access team and ask them to put the files in your datalab folder (you will need to email the files to the microdata access team or provide them on USB). The microdata access team will put the files in a folder within your datalab folder.
The ‘Gendata’ folder in the datalab already contains some Stats plugins- it is worth checking because the files you want might already be here. If they are, you can simply copy and paste them to your datalab project folder
2. Create a folder where you will store all of your Stata plugins, and move the files to that folder.
3. You need to tell Stata to search in your new plugins folder when it is trying to run a program. Type:
adopath + “<filepath to the folder where you are storing your plugins>”
This adds your plugins folder to the list of locations in which Stata will search for programs
4. Check that the new search location has been added using:
It should appear at the bottom of the list.
5. You should now be able to run the plugin. To install further plugins you will only need to copy them to your plugins folder, and you can skip the ‘adopath +’ step
1. Get a copy of the plugin files put into your datalab folder (see method 1 for details). Make a note of where they are as you will need to reference this folder in step 4.
2. Create an empty folder within your datalab folder for the installed plugins. Call it something like ‘Installed plugins’.
3. Tell Stata where to install the new plugins using:
net set ado “<filepath to the ‘Installed plugins’ folder you created in step 2>”
4. You are ready to install the plugins. Tell Stata where to look for the files to be installed using:
net from “<filepath to the folder from Step 1 where the plugin files were loaded>”
5. Install the plugins using:
net install <package name>, replace
6. Check that it has installed using:
7. You need to tell Stata to search in your new ‘Installed plugins’ folder when it is trying to run an installed program. Type:
adopath + “<filepath to the ‘Installed plugins’ folder you created in step 2>”
8. This adds your ‘Installed plugins’ folder to the list of locations in which Stata will search for programs
9. Check that the new search location has been added using:
10. It should appear at the bottom of the list.
11. You should now be able to run the plugin.
Here’s an example of the code that I used to install the traj plugin:
net set ado “Z:\MAA1234-56 Pretend datalab folder\Installed plugins”
net from “Z:\MAA1234-56 Pretend datalab folder\Stata files for install”
net install traj, replace
adopath + “Z:\MAA1234-56 Pretend datalab folder\Installed plugins”
PDF available here (for a printable version).
By Sheree Gibb
Version: Original 15 May 2017