初 级 部 分 Lecture 1 Using directories to organize your work You can find out what directory you're in by typing . pwd F:\StataStuff To find where the "official Stata directory" is, type: . sysdir STATA: C:\Stata8\ UPDATES: C:\Stata8\ado\updates\ BASE: C:\Stata8\ado\base\ SITE: C:\Stata8\ado\site\ PLUS: c:\ado\plus\ PERSONAL: c:\ado\personal\ OLDPLACE: c:\ado\ You don't want to use Stata from the official Stata directory or any subdirectory of it because the Stata directory is only for official Stata software. So if you got the same output from .pwd and .sysdir, you will need to change directories: You can use Stata's mkdir command to create directories, or you can do it outside of Stata using any method allowed by your operating system. If you wanted to make a dirctory on the F drive using Stata, type: . cd F:\ F:\ . mkdir StataStuff2 . cd StataStuff2 F:\StataStuff2 Stata can understand blanks in filenames as long as the whole name is in double quotes. For example if you wanted to name the file Stata Stuff 2, you should have typed: . cd F:\ F:\ . mkdir “Stata Stuff 2” . cd “Stata Stuff 2” F:\Stata Stuff 2 To now go to the directory where we saved the datasets, type: . cd F:\StataStuff F:\StataStuff Dealing w ith files You probably know how to see the contents of a directory, erase files in a directory, copy files from one place to another, and examine the contents of a file using your operating system. You can do this from Stata, too, and sometimes this is convenient. Type: . dir to list the contents of the current directory. Type . dir *.dta to list the files, if any, that have the suffix ".dta" which indicates a Stata file. If the file myfile.xyz is in the current...