UCLA Academic Technology Services HomeServicesClassesContactJobs
Search

Stata Class Notes 3.0
Exploring Data


1.0 Stata commands in this unit

cdChange directory
useLoad dataset into memory
describeDescribe a dataset
listList the contents of a dataset
codebookDetailed contents of a dataset
logCreate a log file
summarizeDescriptive statistics
tabstatTable of descriptive statistics
tableCreate a table of statistics
stemStem-and-leaf plot
graphHigh resolution graphs
kdensityKernel density plot
sortSort observations in a dataset
histogramHistogram for continuous and categorical variables
tabulateOne- and two-way frequency tables
correlateCorrelations
pwcorrPairwise correlations
typeDisplay an ASCII file

2.0 Demonstration and Explanation

use hs0, clear 
describe
list
list gender-read
codebook 
log using unit2, text replace 
summarize
summarize read math science write
display 9.48^2                               /* note: variance is the sd (9.48) squared */
summarize write, detail
sum write if read>=60                   /* note: sum is abbreviation of summarize */
sum write if prgtype=="academic"
sum write in 1/40
tabulate prgtype, summarize(read)
tabulate prgtype, summarize(write)
tabulate prgtype, summarize(math)
tabstat read write math, by(prgtype) stat(n mean sd)
tabstat write, stat(n mean sd p25 p50 p75) by(prgtype)
stem write
stem write, lines(2)
histogram write, normal
histogram write, normal start(30) width(5)
kdensity write, normal
kdensity write, normal width(5)  /* a smoother kdensity plot */
kdensity math, normal
graph box write
graph box write, over(prgtype) 
histogram ses
histogram ses, discrete
tabulate ses
tab write       /* note: tab is abbreviation of tabulate */
tab1 gender schtyp prgtype
tab prgtype ses
tab prgtype ses, all 
correlate write read science
pwcorr write read science, obs
scatter write read
scatter write read, jitter(2)
graph matrix read science write, half 
log close 
type unit2.log 

3.0 For More Information


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