Updating and extending Stata—Internet functionality

1. Internet functionality in Stata

Stata works well with the Internet. Stata can use datasets and view remote help files as though they were on your computer. Stata also can keep itself up to date (with your permission, of course). Finally, you can install community-contributed commands, which are commands that extend Stata’s functionality. These are commands that have been presented in the Stata Journal (SJ) or the Stata Technical Bulletin (STB) or have simply been written and shared by the greater Stata community.

This chapter will show you how you can expand Stata’s horizons.

2. Using files from the Internet

Stata understands URLs as though they were local file locations. If you know of a file on the web that you would like to use, be it a dataset, a graph, or a do-file, you can easily open it in Stata. Here is a small example.

There are many datasets at https://www.stata-press.com/data/. Suppose that you would like to use the census12 dataset used in [U] 11 Language syntax and that you know that its location is https://www.stata-press.com/data/r17/census12.dta. Because you know that the command for opening a dataset is use, you could type the following:

This functionality is everywhere in Stata. Any command that reads a file with a filename in its syntax can use a web address as easily as a file that is stored on your computer.

This example used the HTTP protocol for retrieving the file. Stata also understands the HTTPS and FTP protocols.

3. Official Stata updates

By official Stata, we mean the pieces of Stata that are provided and supported by StataCorp. The other and equally important pieces are the community-contributed additions published in the SJ, distributed over Statalist, or distributed in other ways.

Stata can fetch both official updates and community-contributed commands from the Internet. Let’s start with the official updates. StataCorp often releases updates to official Stata. These updates add new features and, sometimes, fix bugs.

By default, Stata has automatic update checking turned on and set to check for updates every seven days. To change or check your settings, select Edit > Preferences > General preferences… and click on the General tab.

We recommend using automatic update checking because it is a simple, unobtrusive way to be sure that your copy of Stata is always up to date. If you keep this default, you will be prompted with a dialog when you start Stata if you have not recently checked for updates.

To manually check whether there are any official Stata updates, either click on Help > Check for updates or type update query in the Command window. Regardless of which choice you make, Stata goes to check for official updates. After it checks, it will show you your update status. If your copy of Stata is already up to date, you will be told. If your copy of Stata needs updating, you will be told, and a link, Install available updates, will show up in your Results window. You can click on this link or type update all and press Enter. In either case, Stata will download what is needed to bring your copy of Stata up to date. Stata will need to restart after being updated, so it gives you a chance to postpone the update in case there was something (such as saving the command history) you wanted to do in the current session.

Troubleshooting note: If you do not have write permission for C:\Program Files\Stata17, you cannot install official updates in this way. You may still download the official updates, but you will need to use the command-line version of update; see [U] 29 Using the Internet to keep up to date for instructions.

4. Automatic update checking

Stata can periodically check for updates for you. By default, Stata will check once every seven days for updates from the StataCorp website. The seven-day interval is from the last time an update query was performed, regardless of whether it was by Stata or by you. You can change the interval between checks.

Before Stata connects to the Internet to check for an update, it will ask you if you would like to check now, check the next time Stata is launched, or check after the next interval. You can disable the prompt and allow Stata to check without asking.

If an update is available, Stata will notify you. From there, you should follow the recommendations for updating Stata.

You can change the settings for automatic update checking by selecting Edit > Preferences > General preferences… and choosing General.

5. Finding community-contributed commands by keyword

Stata has a built-in utility created specifically to search the Internet for community-contributed Stata commands. You can access it by selecting Help > Search…, choosing Search net resources, and entering a keyword in the field. Choosing Help > SJ and community-contributed features yields more specific choices for searching. The utility searches all community-contributed commands on the Internet, including the entire collection of SJ and STB commands. The results are displayed in the Viewer, and you can click to go to any of the matches found.

For the syntax on how to use the equivalent search keywords, net command, see [R] search.

6. Downloading community-contributed commands

Downloading community-contributed commands is easy. Start by selecting Help > SJ and community-contributed features:

As the Viewer says, try Search… first.

Suppose that you were interested in finding more information or some community-contributed commands involving goodness of fit for logistic regression. You select Help > Search…, select Search all, type logistic goodness of fit in the search box, and click on the OK button.

The first entry points you to all the postestimation commands that are available after logistic regression. The second entry points to Stata’s built-in estat gof command specifically for computing goodness-of-fit statistics after logistic regression. You investigate this command and find it interesting. You see that the next three links point to FAQs and examples on UCLA’s website. Then the next three links are for articles in the SJ. You are interested in multinomial logistic regression, so you decide to check the last of these links. It points to an article in the SJ, volume 12, number 3 (third quarter). You should click on the st0269 link because it will go to the command associated with this article.

You will see that the package has one help file for the new commands. Click the st0269/mlogitgof.sthlp link to see if the mlogitgof command looks interesting. If you decide that you would like to install the command, click the Back button and click on the link click here to install. If you decide that you would like to use some of the ancillary files—files that typically help explain the workings of the command, you could download those, too. You do not need to worry—doing so will not interfere in any way with your copy of Stata. We will show you how to safely uninstall these commands shortly.

You can keep the community-contributed commands you have installed up to date by using the ado update command. Typing ado update will check for updates, while typing ado update, update will check for updates and install any available updates.

Now suppose that you decide that you would like to uninstall the package. Doing so is simple enough: select Help > SJ and community-contributed features, and click on the List link. You should see the following:

If you click on the one-line description of the package, you will see the full description of what has been installed. Here is what you would see if you scroll to the bottom, with a different install date, of course:

You can uninstall materials by clicking on click here to uninstall when you are looking at the package description.

For information on downloading community-contributed commands by using the net command, see [R] net.

Source: STATA (2021), Getting Started with Stata for Windows, Stata Press Publication.

Leave a Reply

Your email address will not be published. Required fields are marked *