初 级 部 分
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:\
中级部分
Table of contents
1. Introduction
2. Do-file or program?
3. Macros
4. Branching and Looping
5. Return values and saving results
6. Reading data
7. Example of data management
8. Reproducible results
9. Ado-files
1. Introduction
If you want to know how to program in Stata, you may have used it interactively before. Sometimes, you may want to reproduce what you have typed interactively. You can type everything again or you can do it in an automated fashion. That’s when programming comes in.
Learning Stata programming doesn’t mean you will stop using the interactive mode. Actually, you can combine these two for better results.
When creating a program in Stata, you should:
determine the objective of the program
determine the methods you want to use in writing the program
create the program to solve the problem
run and test the program
Back to top
1