Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to include data files with ado packages in Stata

Tags:

stata

If I publish an .ado package for Stata, I can include .dta files among the installation files in the .pkg description file, using a line like:

f amazingdata.dta

However, it is not clear how, other than by navigating to an out-of-the-way directory for user-selected add-on packages how users can load these data. For example, is there a way to make data files for .ado files available with commands like:

. sysuse amazingdata
like image 622
Alexis Avatar asked Apr 07 '14 07:04

Alexis


1 Answers

You have found the documentation for package files, so this seems to be a question in the first instance about whether sysuse marches with installations of user-written packages, and the short answer is an emphatic No.

sysuse is intended as a quick-and-easy way for Stata users to access datasets made available by StataCorp to support official commands. I have not tried it, but my guess is that sysuse would work with any dataset so long as that dataset was placed in the directories searched by Stata.

However, I would argue that would be very poor style. When Stata programmers publish a package centred on programs and their help files, they often make test datasets available, but the best standard is to mark such files as ancillary and let users download them to a location of their own choice using net get. As said, this is a choice.

The argument can be strengthened. It's best practice to keep StataCorp's own files and other files strictly segregated. That way, updates and upgrades, copying files to other machines, etc. all are much less likely to get confused or tangled given some clash of names. Most likely, you might install or reinstall Stata and "forget" that you had user-written stuff mixed in with StataCorp's own files and waste time trying to find it.

In any case, for sysuse to work like this, users would have to install files manually in the place(s) searched by Stata, as Stata's download commmands would not do that automatically.

As for "out-of-the-way", this is not for you to decide. Many users have very strict personal or workplace rules that each project requires quite different directories or folders, so placing files only where they can be found quite deliberately is, in their own terms, a very good idea. Otherwise put, the net get mechanism implies that users decide, carefully or not, where files are to go. Users also have the scope to manipulate their adopath should they wish to supplement Stata's rules on where it searches.

like image 187
Nick Cox Avatar answered Oct 29 '22 17:10

Nick Cox