|
|
|
||||
|
|
|||||
use http://www.ats.ucla.edu/stat/stata/notes3/hsb2 describe
summarize summarize read write summarize read, detail tabulate prog, sum(read) table prog, contents(n read mean read sd read) stem read histogram read graph box read
tabulate read tabulate prog tabulate prog, nolabel tab1 female prog ses tabulate prog ses tab2 prog ses female
sort prog by prog: summarize read write math sort female by female: summarize read write math
graph bar read, over(prog) graph box write, over(prog)
summarize read write math if ses=="high" summarize read write math if ses=="3" summarize read write math if ses==3 summarize read if ses==1 | ses==2 summarize read if ses~=3 summarize read if ses < 3 summarize read if female==2 & ses < 3
scatter read write correlate read write math science graph matrix read write math science, half
generate total = read + write summarize total replace total = total + math summarize total generate honors = . replace honors = 1 if write >= 60 & write < 100 replace honors = 0 if write >= 0 & write < 60 tabulate honors generate highses = ses recode highses 3=1 1 2=0 tabulate highses
Smith 79 84 Jones 87 86 Brown 91 94 Adraktas 80 84 clear edit save mydata
You can also enter data using a text editor or word processor. Below is a data file called tdata.raw. It was created using a text editor and saved "plain" ascii text.
-------------------------------tdata.raw----------------------- "Smith" 79 84 "Jones" 87 86 "Brown" 91 94 "Adraktas" 80 84 "Johnson" 78 83 "James" 86 82 "Scott" 90 93 "Sanders" 79 83 "Henderson" 77 82 "Allen" 85 84 "Murphy" 89 92 "Jackson" 78 82 --------------------------------------------------------------- clear copy http://www.ats.ucla.edu/stat/stata/notes3/tdata.raw tdata.raw infile str10 name midterm final using tdata.raw save tdata
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