

graph twoway - generates a two variable scatterplot.By the time you're done with this class, you'll know what that means. regress - fits a linear regression model of a dependent variable on a single predictor or set of predictors.Means option gets summary stats for each variable. correlate - displays the correlation matrix for a list of variables.By option gets statistics for subgroups.īy race: summarize rdg wrtg math, detail (note: race must be sorted first) Detail option gets more statistics and percentiles. summarize - calculates summary statistics such as mean and standard deviation.

Summarize option gets summary stats for subgroups. tabulate - gets counts and percents of subgroups for 1 or 2 variables.generate - computes a new variable based on an expression.The search command can be used to get a more detailed description of the return code. If you make a mistake with a Stata command, it may return an error message along with a return code. This allows you to find help on command statements and return codes which appear alongside of error messages. search - searches Stata help for matching strings.
#Stata commands download#
You can download all of the Stata used throughout this blog via this link: Stata Table Command.
#Stata commands how to#
Statistics > Summaries, tables, and tests > Tables of frequencies, summaries, and command results College Graduateįor an example of how to use the table editor, check this video You can do everything above through a point and click (including changing the
#Stata commands full#
The below to the export code gives you the full code to create the same tableĮxport "…\table1.docx", as(docx) dofile("…\commands.do", Neat thing is that you can also do the table above using putdocx adding () ( collgrad ) (), statistic(frequency) statistic(percent) statistic(mean age exper) statistic(sd age exper) nformat(%9.1f percent)Ĭan export the table to any format (Word file, PDF, HTML, etc.) (instead of the variables), remove the var from the first bracket: You would like to show the mean and standard deviation in separate sections Variable exper "Total Work Experience (year)" Percent) sformat("%s%%" percent) nformat(%9.1f mean) nformat(%9.1f sd)Ĭan edit the labels of age and exper to make the table cleaner ( var ) ( collgrad ) (), statistic(frequency) statistic(percent) The code becomes (including formatting options to show the mean and standard deviation in one decimal): We would like to show the frequency and percent of college graduates and show the mean and standard deviation of age and experience by college graduate or not. Now, we would like to add a lot more details to the table. To run a command from the do-file, highlight part or all of the command, and then hit CtrlD (Mac: Shift+Cmd+D) or the Execute(do) icon, the rightmost icon on the do-file editor toolbar. Now, you would like the percent statistic to be a column rather than a Stata 16 features an enhanced editor that features tab auto-completion for Stata commands and previously typed words. The percent instead of frequencies, the code is: The three brackets before the comma could be empty, have variable names, or We use the command table to create a simple table of frequencies of Label variable collgrad "College Graduate" We first edit the labels of the variable collgrad This data is one of the many data sets used for training purposes. We use the NLS data which is based on the National Longitudinal Survey of Young Women 14-26 years of age in 1968. Stata 17 offers a new and exciting way to create and customize tables using the commands table and collect.

Tables are in every report, article, and book chapter. This blog post is written by Dr George Naufal, assistant research scientist at the Public Policy Research Institute (PPRI) at Texas A&M University and a research fellow at the IZA Institute of Labor Economics.
