UCLA Academic Technology Services HomeServicesClassesContactJobs
Search

Stata Class Notes
Getting Started


1.0 Stata commands in this unit

We begin by showing how some of the commands work. We will not be showing all of the options for any of the commands.

. cd
mkdir
use
summarize
univar
graph
correlate
tabulate
help
search

2.0 Demonstration and Explanation

Type in the commands at the same time as the class instructor. Don't worry if you fall behind. There will be time to catch up when we move on to the next unit in a few minutes.

2.1 Getting Started

. mkdir statacls
cd statacls
log using unit1, text
use http://www.ats.ucla.edu/stat/stata/notes/hsb1

. summarize read math science
summarize read, detail

. univar read math science

. graph read

. correlate read write math

. graph read math

. tabulate ses
tabulate ses, nolabel

. tabulate ses
tabulate ses female, all

. help tabulate
help tab
search residual

2.2 Closing the log file

The log command is now used to close the log file. You can view the log file, unit1.log, with any text editor or word processor or you can enter the type command:

. log close
type unit1.log

2.3 Copying Stata Output and Graphs to Word

A common thing that you might want to do is to copy your Stata output and/or graphs to Word.  You can see the Stata Frequently Asked Question How do I Copy Stata Output and Stata Graphs into Word? to learn more about this.

3.0 Try the commands on your own

. use http://www.ats.ucla.edu/stat/stata/notes/hsb1
summarize read write math
summarize read, detail
graph read
correlate read write math
graph read math
tabulate ses
tabulate ses, nolabel
tabulate ses female
tabulate ses female, chi2
help summarize
search homogeneity

4.0 Can You Answer These Questions?

  1. What is the mean and standard deviation of socst?
  2. How many Hispancs are in the sample?
  3. How many Hispanic females are in the sample?
  4. What is the correlation between read and science, read and socst?

5.0 For More Information

6.0 Web Notes

The Stata Class Notes are available on the World Wide Web by visiting ...
      http://www.ats.ucla.edu/stat/stata/notes/

Note: .dta is the extension for Stata-format files. Stata automatically includes .dta on files when they are saved. You do not have to include the .dta when reading datasets using Stata.


How to cite this page

Report an error on this page

UCLA Researchers are invited to our Statistical Consulting Services
We recommend others to our list of Other Resources for Statistical Computing Help
These pages are Copyrighted (c) by UCLA Academic Technology Services


The content of this web site should not be construed as an endorsement of any particular web site, book, or software product by the University of California.