UCLA Academic Technology Services HomeServicesClassesContactJobs
Help the Stat Consulting Group by giving a gift             
Loading

Stata Class Notes
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

2.0 Demonstration and explanation

use http://www.ats.ucla.edu/stat/data/hs0, clear

describe
list
list gender-read
codebook 
log using unit2.txt, 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
tabstat read write math, by(prgtype) stat(n mean sd)
tabstat write, by(prgtype) stat(n mean sd p25 p50 p75)
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, row col 
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 
view unit2.txt 

3.0 For more information


How to cite this page

Report an error on this page or leave a comment

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.