Stata Windows environment
The Stata PDF documentation includes a section called "Getting Started with Stata for Windows." It's a readable yet thorough introduction, and much of it is a tutorial. It's available under the Help menu - click on PDF Documentation, Getting started, and it's the first item listed.
If you don't have access to that volume, you can use this page for some general pointers to get you started.
Starting and stopping Stata
At CPC, Stata may be installed on your desktop or laptop, or it may only be available on one of the terminal servers. Contact CPC Help if you can't find it. Assuming you have an icon, double click it to start.
Click on the "X" in the upper right corner to stop Stata. If you have data in memory, and you've changed the data in any way (even sorting), Stata won't let you quit without either saving the data to a permanent file or clearing data from memory. If you're sure you don't want to save the data in memory, you can type:
to get out of Stata.
Stata gives you 5 windows by default: Command, Results, Review, Variables, and Properties.
- Command: type a command here and press Enter
- Results: the results of your command are displayed here
- Review: each command you type is displayed here
- Click on a command to put it into the command window for editing
- Double-click on a command to run it directly
- Properties: metadata about the variables and datasets in memory, the equivalent of the describe command
- Variables: lists the variables in memory
- Click on the arrow next to a variable name to put it into the command window (hover the mouse over the variable name to see the arrow)
You can move and resize these 5 windows independently, and you can resize the outer window as well. To save your window changes, click on Edit, Preferences, Save Preferences Set.
Stata displays 8 drop-down menus across the top of the outer window:
- Open: open a Stata data file (use)
- Save/Save as: save the Stata data in memory to disk
- Do: execute a do-file
- Log: begin writing the contents of the Results window to a file
- Import/Export: work with Excel, SAS transport, and other formats of files
- Print: print results
- Exit: quit Stata
- Copy/Paste: copy text among the Command, Results, and Log windows
- Copy Table: copy a highlighted table from Results window to another file
- Copy Picture: copy the highlighted section of the Results window as a picture
- Find: find a text string in the Results window
- Table copy options: what to do with table lines in Copy Table
- Data, Graphics, Statistics - build and run Stata commands from menus
- User - menus for user-supplied Stata commands (download from Internet)
- Window - bring a Stata window to the front
- Help - The Stata manual set in PDF format plus Stata command syntax and keyword searches
The buttons on the button bar are from left to right (equivalent command is in bold):
- Open a Stata data file: use
- Save the Stata data in memory to disk: save
- Print a log or graph
- Open a log, or suspend/close an open log: log
- Open a new viewer window (to view Help or a log file)
- Bring the graph window to the front (if you've created a graph)
- Open a do-file
- Edit the data in memory: edit
- Browse the data in memory: browse
- Open the Variables Manager
- Scroll another page when --more-- is displayed: Space Bar
- Stop current command or do-file: Ctrl-Break
Sources of help
- Help menu
- PDF Documentation: the full reference manual at your fingertips
- Stata Command: almost the full reference manual for each Stata command
- Search: keyword search of the manuals, technical bulletins, and frequently asked questions
- and lots more!
- Data, Graphics, and Statistics menus
- builds a command with the correct syntax for you
- leads you to consider options that you might easily overlook
At CPC we no longer carry the printed manual set, since it's available in PDF in the Help menu. However, we do have other Stata and third-party books that focus on specific topics in Stata programming. These books are shelved in the CPC library and can be checked out.
See getting help for Stata for more resources.