UCLA Academic Technology Services HomeServicesClassesContactJobs
Search

Stata Class Notes
About the Dataset


1.0 Stata commands in this unit

Again, we will not be showing all of the options for any of the commands.

. list
describe
codebook
display
inspect

if exp qualifier
in range qualifier

2.0 Demonstration and Explanation

. list
list female ses read science

. list female ses read science if science==.
list female ses read science if ses=="high"
list female ses read science if ses==3

Logical operators used in Stata

    ~       not
    ==       equal
    ~=       not equal
    !=       not equal
    >       greater than
    >=       greater than or equal 
    <       less than
    <=       less than or equal
    &       and
    |       or



list female ses read math in 50/60
list female ses read math in f/10
list female ses read math in -10/l

. describe

. codebook
codebook female ses race

. inspect female ses race

. summarize math
display 9.368^2

2.2 Remarks about if and in qualifiers

The if and in qualifiers work with almost all Stata commands. See how these commands from Unit 1 work with the qualifiers.

. summarize read write math if ses==3
correlate read write math in 50/150
graph read math if female==0
tabulate ses if read>50
tabulate ses female in 1/60

3.0 Try the commands on your own

. list
list female ses read science
list female ses read science if science==.
list female ses read science if ses=="high"
list female ses read science if ses==3
list female ses read science in f/10
list female ses read science in -10/l
describe
codebook female ses race
display 27.8^3.2
display (57.5 - 52.23)/10.25294

4.0 Can you answer these questions?

  1. What cases have a math score greater than 71?
  2. What is the race for those cases in which science is missing?
  3. What can you find out about the variable schtyp?
  4. What is two to the tenth minus one?

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: The dataset hsb2.dta is the same as hsb1.dta but without the missing data for science or the race values coded 5.


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.