11.07.2015 Views

[U] User's Guide

[U] User's Guide

[U] User's Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

238 [ U ] 18 Programming Stataand store the file in your current directory or your personal directory (see [U] 17.5.2 Where is mypersonal ado-directory?), you could type hello and be greeted by a reassuring. hellohi thereYou could, at that point, think of hello as just another part of Stata.There are two places to put your personal ado-files. One is the current directory, and that is agood choice when the ado-file is unique to a project. You will want to use it only when you arein that directory. The other place is your personal ado-directory, which is probably something likeC:\ado\personal if you use Windows, ~ /ado/personal if you use Unix, and ~ /ado/personalif you use a Mac. We are guessing.To find your personal ado-directory, enter Stata and type. personalTechnical noteStata looks in various directories for ado-files, defined by the c-class value c(adopath), whichcontainsUPDATES;BASE;SITE;.;PERSONAL;PLUS;OLDPLACEThe words in capital letters are codenames for directories, and the mapping from codenames todirectories can be obtained by typing the sysdir command. Here is what sysdir shows on oneparticular Windows computer:. sysdirSTATA:UPDATES:BASE:SITE:PLUS:PERSONAL:OLDPLACE:C:\Program Files\Stata11\C:\Program Files\Stata11\ado\updates\C:\Program Files\Stata11\ado\base\C:\Program Files\Stata11\ado\site\C:\ado\plus\C:\ado\personal\C:\ado\Even if you use Windows, your mapping might be different because it all depends on where youinstalled Stata. That is the point of the codenames. They make it possible to refer to directoriesaccording to their logical purposes rather than their physical location.The c-class value c(adopath) is the search path, so in looking for an ado-file, Stata first looks inUPDATES then in BASE, and so on, until it finds the file. Actually, Stata not only looks in UPDATESbut also takes the first letter of the ado-file it is looking for and looks in the lettered subdirectory. Forfiles with the extension .style, Stata will look in a subdirectory named style rather than a letteredsubdirectory. Say that Stata was looking for gobbledygook.ado. Stata would look up UPDATES(C:\Program Files\Stata11\ado\updates in our example) and, if the file were not found there,it would look in the g subdirectory of UPDATES (C:\Program Files\Stata11\ado\updates\g)before looking in BASE, whereupon it would follow the same rules. If Stata were looking forgobbledygook.style, Stata would look up UPDATES (C:\Program Files\Stata11\ado\updatesin our example) and, if the file were not found there, it would look in the style subdirectory ofUPDATES (C:\Program Files\Stata11\ado\updates\style) before looking in BASE, whereuponit would follow the same rules.Why the extra complication? We distribute hundreds of ado-files, help files, and other file typeswith Stata, and some operating systems have difficulty dealing with so many files in the same directory.All operating systems experience at least a performance degradation. To prevent this, the ado-directorywe ship is split 28 ways (letters a–z, underscore, and style). Thus the Stata command ci, whichis implemented as an ado-file, can be found in the subdirectory c of BASE.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!