banner



How To Change Default Directory In Stata

Directory Navigation in Stata

For all intents and purposes, "working directory" is tech-speak for "whatever binder Stata thinks you're in." This is relevant because when you run commands that involve files, the working directory is where Stata volition look for those files.

Which directory Stata is working in is always displayed at the bottom of the Stata toolbar

If the wrong directory is being displayed, in that location are two means to modify it. The first mode, which is perhaps too the easiest for those who are new to command line (non-graphic) interfaces is to utilize the menus, . From here yous can navigate to wherever the file(s) yous are going to employ is/are stored. Select a binder by double-clicking on it, then click .

When you exercise and then in this way, y'all'll notice the window displays the command cd followed by a serial of binder names separated by slashes. This command, the same equally used in Terminal or a Windows command prompt, is curt for "change directory" and is the 2nd way to switch the current working directory.

The two commands needed to navigate like this are cd and ls. The latter (ls) causes Stata to listing the contents of your current directory. cd moves y'all into the specified directory, provided you include the proper path to the file.

A useful alternative way to recall about file paths, since the linguistic communication is a fleck nonintuitive, is as an address if anybody lived in a tree. With this illustration, you lot can consider a program similar Stata to be a tree postman. The very bottom of your tree is the hard drive itself, known every bit the root directory, its accost is "~"

Withal since y'all are logged in to the figurer as a user, the next office of the address is predetermined: /Users/yourusername. In add-on, Stata assumes yous are working in the Documents folder, which leaves you on the tree co-operative that is your certificate folder: Users/yourusername/Documents (this should in fact be what displays in the toolbar when you lot open Stata).

At present permit's say you lot really have the files y'all want for this Stata session in a folder of Psychology data. Specifically, the information is in Documents => Thesis => Thesis Information => Experiment 1.

Assuming I know for sure that is the full prepare of folders I have to go through (and that I'm starting from Documents) I could type cd "Thesis/Thesis Date/Experiment 1" Since my file path has spaces, I use quote marks around the whole thing (otherwise, Stata will non empathize where y'all want to become)

If I was less certain what the precise file path was, I could cd one level at a time, using ls to meet where to go next.

One last useful command for navigating is cd .. The .. tells Stata to back up one Directory.

While at outset this may sound hard to manage, with a fiddling practice y'all'll be navigating your directories with file paths in no time.

Dorsum

How To Change Default Directory In Stata,

Source: https://www.reed.edu/psychology/stata/gs/tutorials/cd.html

Posted by: alvarezhourgen39.blogspot.com

0 Response to "How To Change Default Directory In Stata"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel