Bibliographic record and links to related information available from the Library of Congress catalog
Note: Electronic data is machine generated. May be incomplete or contain other coding.
0 Getting started I 1 Sonme basic commands 5 1.1 The births data . . . .. .. ...... . . . 5 2 A first ook at the data ........... 6 1.3 Tables of frequencies .. .. . . 1.4 Tables of means and other things . ... . . 9 1.5 Restricting the scope of commands.. . .. . 10 1.6 Gneraing new variables . ........ 10 1.7 Ordering, dropping and keeping . . . .. . . . . . . . 11 1.8 Sorting data. .. ......... . . . 12 1.9 Using Stata as a alculator . . 12 1.10 Shortcuts .. ............ 13 1..11. Sata syntax ............ ... . 14 1.12 Using the Stata help facilities ....... .... ... 14 2 Tabs, menus and dialog boxes 17 2.1 Wthere to find the dialog boxes .... .. ..... . . . 17 2.2 A first look at the data . . .. . 17 23 Tables of frequencies ........ .... 19 2,4 Tables of means and other things . .... . 20 2.5 Restricting the scope of commands . . . 21 2.6 Generating new variables . . . . 21 2.7 Ordering, dropping and keeping ... . . . . 22 2.8 Sorting data . ... ... . .. 22 2.9 Using Stata as a calculator . . ... . 23 3 Housekeeping 24 3.1 Labelling a dataset . ... .. .... 24 3.2 N otes .. . . . . . .. . . . . . . . . . . . . . 24 3.3 Labelling variables and their values . . .. . . .. . 25 3.4 Data types and display ' formats . . . . . .. . . . . . . . 26 3.5 Recoding a variable ....... .. . . .. 27 3.6 Missing values . .. . . . . .. 27 3.7 Dates . . 2. .8 . 2 3.8 Saving files ........ 30 4.2 Data from a spreadsheet ... 34 4.3 Data from a wordprocessor.. 35 4.4 Large datasets ...... . 35 4.5 More about dictionary files .. . . . . 36 4.6 Loading data from the keyboard .. .... . . .. . . 36 47 Dat output ............ 37 4.8 Import and export to other packages . . . . . 38 5 Graph commands 40 5.1 Box plots .... .. 40 5.2 Histograms ........... .. 41 5 3 Scatter plots .. . .... .. .. 42 5.4 Overlaying graphs . . . ......... . 43 5.5 Line plots ....... ............ 43 5.6 Cumulative distribution plots . . . . . .. 4. 5.7 Adding lines ............. . 46 5.8 Graph titles .. . . .... ........... .... 46 5.9 Titles and labels for axes 47 5.10 Naming, saving, and combining graphs . . . ... . . . .... 48 5.11 Printing and exporting graphs .. ... . . . .. . 49 5.12 Sche es ... ........... . . 50 5.13 Hep for graphics . .... . . .. . . . .. . 50 6.3 Bar charts........... 5 6.4 Twoway graphs ........... . . 6.5 Overlaid twoway graphs .......... 56 7 More basic tools 58 7.1 The return list . . . . . . . . . . . . . . . . . . . . . . . . . .. . . 58 7.4 Comparing two means or two proportions . ....... . 61 7.5 W eights . ............. .. 62 7.6 Repeating commanads for different sub-groups . .. 63 7.7 Repeating commands for different variables ... . 64 8 Data management 67 81 Cleaning data ......... .. 67 8.2 String variables .. .... ... . 68 8 3 Appendinmg to add more subjects. .. .. 69 8 4 Merging to add more variables . . . . . ... ..70 8.5 Merging to update variables . . . 71 8.6 Unmatched merges ..... ........ 72 9 Repeated measuremrnets 74 9.1 Wide and long coding ...... .. 74 "9.2 Graphing repeated melaures . . 93 orking at th group level ..... .......... 76 9.4 Collapsing the daa . ..... . . ...... 76 9.5 Reshaping from long to wide and vice versa ... . . 7 9.6 Use of system variables with bv: .. . . . . .... . . . 78 9.7 Merging files with long coding ... ... 79 10 Response and explanatory variables 82 10 1 Questions in statistical analysis .. . . . . . .. . . . 82 10.2 Producing tables with tabmore . .. . . . . . 83 10.3 A second explanatory variable.. . . 85 10.4 O dds . . . . . . . . . . . . . . . . . .. .. . .. . . . . . 86 10.5 Caseecontrol studies . .86 10.6 Survival data and rates ... ....... .. 89 10.7 Count data and rates . ........ ......... 90 11 Measuring effects 92 11.1 A metric response .. . .. . 92 11.2 A binary response . ........ ...... ...... 94 11.3 Case-control studies ................ 95 11.4 A failure response . i... . .... .. . . . 95 11.5 Metric exposure variables .. ..... .... ..... . 96 11.6 Metric versus grouped .... . . . .. .. 98 12 Stratifying and controlling 100 12.1 Statilfication . .. ... . ......... .. ... .. ... 100 12.2 Controlling ..... ....... . . ..... 101 12.3 Controlling the effect of a metric exposure . . . .. . . . . 103 12.4 Metric control variables ......... . 103 12.5 Metric versus grouped ........... . . . 104 13 Regression commands 105 13.1 Three important regression models . ... . .. 105 13.2 A metric exposure .............. . 106 13.3 A categorical exposure with two levels ...... . . 108 13.4 Categorical exposures with more than 2 levels . 110 13.5 Fitted values and residuals . ........ ....... 113 13.6 Case-control studies ...... .............114 14 Tests of hypotheses 116 14.1 Mlodels and Likelihood . .. . . ...... . . . ... 116 14.2 Log likelihood .... . ......... ...... .. .. 118 14.3 Likelihood ratio and Wald tests in Stata . I . . . 119 14.4 Joint tests of several parameters . . . . . . .. . 121 14.5 Other regression commands . .. . . . . . . . . 122 15 Controlling and stratifying with regression 124 15.1 Controlling with regression commands . . . . . 124 15.2 Testing effects after controlling .. . . . ... 12- 15.3 Stratifying with regression commands . . . . . . . . .126 15.4 Testing for effect modification and interactions . . . . . . 127 "15.5 interactions with metric variables . .. .. . 128 16 Mantel-Haenszel meth ods 130 16.1 The method . .... . 130 16.2 The Stata command . . . ... .. 131 16.3 Matched case-control studies . . . 132 16.4 Mantel-Haeenszel methods for rates . . . . 1. 33 16.5 Exposures on more than two levels .. . .134 17 Survival data and stset 136 17.1 The response in survival data .... . . ...... 136 17.2 Summarizing survial time ......... .... 137 17.3 Calculating rates and rate ratios . . .. 138 17.4 Variables created by stset . ....... . . . . .. 139 17.5 Rates that varyn witi tine ... ..... .... . 140 17.6 Cox regression .. ......... . . 142 18 Different time scales and standardization 144 18A Follow-up time ....... ... ... 144 18.2 .The diet data .......... .. 145 18.3 Rates that change with time . . 146 18.4 Using non-st commands with st data . 147 18.5 FTwo time-scales. ..... . . . . . 148 18.6 Standardization . . . 149 19 Writing Stata programs 153 19.1 Starting with a do file ... . .. . . . . .. 153 19.2 Making the do file into an ado file . . 153 19.3 Cutting out unwanted output . . 155 19.4 Making the program accept arguments . . . . . . 155 19.5 Allowing if, in, and options I , . 156 19.6 Discarding previous versions of a program 157 19.7 Another example .. ... 158 19.8 Some additional programming points . . 161 20 How Stata is organized 163 20.1 Paths and programs. . . .. . 163 20.2 Updating Stata . . . . 1 . .65 20.3 The Stata Journal . . . . . 165 20.4 User-contributed programs . . . . 166 205 The Statalist .. . 167 20.6 Other sources of help . .. . t. 167