{{Short description|Statistical software package}} {{Distinguish|Stada|Ray Stata}} {{Infobox software | name = Stata | logo = stata_logo_med_blue.png | screenshot = Stata19.png | caption = Stata 19 on Windows | author = William Gould<ref name="newton2015">{{cite journal |last1=Newton |first1=H. Joseph |title=A conversation with William Gould |journal=The Stata Journal |date=2005 |volume=5 |issue=1 |pages=19–31 |doi=10.1177/1536867X0500500103 |s2cid=118322998 |doi-access=free }}</ref> | developer = StataCorp | released = {{Start date|1985}} | latest release version = 19.0 | latest release date = {{Start date and age|2025|04|8}} | programming language = C | operating system = Windows, macOS, Linux | genre = Statistical analysis<br />Numerical analysis | license = Proprietary | website = {{URL|https://www.stata.com/}} }}
'''Stata''' ({{IPAc-en|ˈ|s|t|ei|t|@}},<ref>{{cite web |last1=Cox |first1=Nicholas J. |title=Statalist FAQ |url=https://www.statalist.org/forums/help#spelling |website=Statalist: The Stata Forum |access-date=24 April 2021}}</ref> {{respell|STAY|ta}}, alternatively {{IPAc-en|ˈ|s|t|ae|t|@}}, occasionally stylized as STATA<ref>{{cite web|url=https://www.iuj.ac.jp/faculty/kucc625/documents/DM1.pdf|title=STATA Data Manipulation: Basics and Applications 7|website=Iuj.ac.jp|access-date=27 January 2022}}</ref><ref>{{cite book |title = biostatistics-in-public-health-using-stata |last1= Suárez |first1 = Erick |last2 = Pérez|first2 = Cynthia |last3 = Nogueras|first3 = Graciela |last4 = Moreno-Gorrín|first4 = Camille |year= 2016 |url = https://www.stata.com/bookstore/biostatistics-in-public-health-using-stata/}}</ref>) is a general-purpose statistical software package developed by StataCorp for data manipulation, visualization, statistics, and automated reporting. It is used by researchers in many fields, including biomedicine, economics, epidemiology, and sociology.<ref>{{cite web|url = https://www.stata.com/disciplines/|title = Disciplines|website=Stata: Software for Statistics and Data Science|access-date = 2021-04-21}}</ref>
Stata was initially developed by Computing Resource Center in California and the first version was released in 1985.<ref name="cox2005">{{cite journal |last1=Cox |first1=Nicholas J. |title=A brief history of Stata on its 20th anniversary |journal=The Stata Journal |date=2005 |volume=5 |issue=1 |pages=2–18 |doi=10.1177/1536867X0500500102 |s2cid=118366843 |doi-access=free }}</ref> In 1993, the company moved to College Station, Texas and was renamed Stata Corporation, now known as StataCorp.<ref name="newton2015" /> A major release in 2003 included a new graphics system and dialog boxes for all commands.<ref name="cox2005" /> Since then, a new version has been released once every two years.<ref name="versions">{{cite web |last1=Gould |first1=William W. |last2=Cox |first2=Nicholas J. |title=When was Stata first released? When were later versions released? |url=https://www.stata.com/support/faqs/resources/history-of-stata/ |website=Stata: Software for Statistics and Data Science |access-date=22 April 2021}}</ref> The current version is Stata 19, released in April 2025.<ref>{{cite web |title=What's new in Stata? |url=https://www.stata.com/new-in-stata/ |website=Stata: Software for Statistics and Data Science |publisher=StataCorp |access-date=8 April 2025}}</ref>
== Technical overview and terminology == === User interface === From its creation, Stata has always employed an integrated command-line interface. Starting with version 8.0, Stata has included a graphical user interface which uses menus and dialog boxes to give access to many built-in commands. The dataset can be viewed or edited in spreadsheet format. From version 11 on, other commands can be executed while the data browser or editor is opened.
=== Data structure and storage === Until the release of version 16,<ref>{{Cite web|title=Data frames: multiple datasets in memory|url=https://www.stata.com/new-in-stata/multiple-datasets-in-memory/|access-date=2020-08-13|website=Stata.com}}</ref> Stata could only open a single dataset at any one time. Stata allows for flexibility with assigning data types to data. Its <code>compress</code> command automatically reassigns data to data types that take up less memory without loss of information. Stata utilizes integer storage types which occupy only one or two bytes rather than four, and single-precision (4 bytes) rather than double-precision (8 bytes) is the default for floating-point numbers.
Stata's proprietary output language is known as SMCL, which stands for Stata Markup and Control Language and is pronounced "smickle".<ref>{{Cite book |title=Stata 18 Base Reference Manual |publisher=Stata Press |date=2023 |location=College Station, TX}}</ref>
Stata's data format is always tabular in format. Stata refers to the columns of tabular data as variables.
=== Data format compatibility === Stata can import data in a variety of formats. This includes ASCII data formats (such as CSV or databank formats) and spreadsheet formats (including various Excel formats).
Stata's proprietary file formats have changed over time, although not every Stata release includes a new dataset format. Every version of Stata can read all older dataset formats, and can write both the current and most recent previous dataset format, using the <code>saveold</code> command.<ref>{{Cite web|url=https://www.stata.com/help.cgi?save|title=Stata 16 help for save|website=Stata.com}}</ref> Thus, the current Stata release can always open datasets that were created with older versions, but older versions cannot read newer format datasets.
Stata can read and write SAS XPORT format datasets natively, using the ''fdause'' and ''fdasave'' commands.
Some other econometric applications, including gretl, can directly import Stata file formats.
== History ==
The development of Stata began in 1984, initially by William (Bill) Gould and later by Sean Becketti. The software was intended to compete with statistical programs for personal computers such as SYSTAT and MicroTSP.<ref name="cox2005" /> Written in the C programming language, Stata was released for MS-DOS in 1985 with 44 commands.<ref name="cox2005" /> Since then, versions of Stata have been released for systems running Unix variants like Linux distributions, Windows, and MacOS.<ref name="cox2005" /> All Stata files are platform-independent.
{| class="infobox mw-collapsible" |+ class="nowrap" | Commands in Stata 1.0 and Stata 1.1 |- style="font-family:monospace;" | append | style="padding-left:1.0em;" | dir | style="padding-left:1.0em;" | infile | style="padding-left:1.0em;" | plot | style="padding-left:1.0em;" | spool |- style="font-family:monospace;" | beep || style="padding-left:1.0em;" | do || style="padding-left:1.0em;" | input || style="padding-left:1.0em;" | query || style="padding-left:1.0em;" | summarize |- style="font-family:monospace;" | by || style="padding-left:1.0em;" | drop || style="padding-left:1.0em;" | label || style="padding-left:1.0em;" | regress || style="padding-left:1.0em;" | tabulate |- style="font-family:monospace;" | capture || style="padding-left:1.0em;" | erase || style="padding-left:1.0em;" | list || style="padding-left:1.0em;" | rename || style="padding-left:1.0em;" | test |- style="font-family:monospace;" | confirm || style="padding-left:1.0em;" | exit || style="padding-left:1.0em;" | macro || style="padding-left:1.0em;" | replace || style="padding-left:1.0em;" | type |- style="font-family:monospace;" | convert || style="padding-left:1.0em;" | expand || style="padding-left:1.0em;" | merge || style="padding-left:1.0em;" | run || style="padding-left:1.0em;" | use |- style="font-family:monospace;" | correlate || style="padding-left:1.0em;" | format || style="padding-left:1.0em;" | modify || style="padding-left:1.0em;" | save || style="padding-left:1.0em;" | |- style="font-family:monospace;" | count || style="padding-left:1.0em;" | generate || style="padding-left:1.0em;" | more || style="padding-left:1.0em;" | set || style="padding-left:1.0em;" | |- style="font-family:monospace;" | describe || style="padding-left:1.0em;" | help || style="padding-left:1.0em;" | outfile || style="padding-left:1.0em;" | sort || style="padding-left:1.0em;" | |}
There have been 19 major releases of Stata between 1985 and 2025 and additional code and documentation updates between major releases.<ref name="versions" /> In its early years, extra sets of Stata programs were sometimes sold as "kits" or distributed as Support Disks. With the release of Stata 6 in 1999, <code>update</code>s began to be delivered to users via the web.<ref name="cox2005" />
Hundreds of commands have been added to Stata in its 37-year history.<ref>{{cite book |title=Stata Glossary and Index: Release 17 |publisher=Stata Press |location=College Station, TX |isbn=1-59718-283-4 |pages=1–50 |url=https://www.stata.com/manuals/icombinedsubjecttableofcontents.pdf}}</ref><ref>{{cite web |title=Stata features |url=https://www.stata.com/features/ |website=Stata: Software for Statistics and Data Science |publisher=StataCorp |access-date=24 April 2021}}</ref> Certain developments have proved to be particularly important and continue to shape the user experience today, including extensibility, platform independence, and the active user community.<ref name="cox2005" />
===Extensibility=== The <code>program</code> command was implemented in Stata 1.2, giving users the ability to add their own commands.<ref name="cox2005" /><ref>{{cite web |title=program - Define and manipulate programs |url=https://www.stata.com/manuals/pprogram.pdf |website=Stata: Software for Statistics and Data Science |publisher=Stata Press |access-date=24 April 2021}}</ref> ado-files followed in Stata 2.1, allowing a user-written program to be automatically loaded into memory. Many user-written ado-files are submitted to the Statistical Software Components Archive hosted by Boston College. StataCorp added an <code>ssc</code> command to allow community-contributed programs to be added directly within Stata.<ref>{{cite web |title=ssc - Install and uninstall packages from SSC |url=https://www.stata.com/manuals/rssc.pdf |website=Stata: Software for Statistics and Data Science |publisher=Stata Press |access-date=24 April 2021}}</ref> More recent editions of Stata allow users to call Python scripts using commands, as well as allowing Python IDEs like Jupyter Notebooks to import Stata commands.<ref>{{cite web |url=https://www.stata.com/python/ |title = Use Python and Stata together {{!}} Stata}}</ref> Although Stata does not support R natively, there are user-written extensions to use R scripts in Stata.<ref>{{Cite web|url=https://fsolt.org/blog/2018/08/15/switch-to-r.html|title=How to Switch Your Workflow from Stata to R, One Bit at a Time · Frederick Solt|website=Fsolt.org|access-date=27 January 2022}}</ref>
===User community=== A number of important developments were initiated by Stata's active user community.<ref name="cox2005" /> The ''Stata Technical Bulletin'', which often contains user-created commands, was introduced in 1991 and issued six times a year. It was relaunched in 2001 as the peer-reviewed ''Stata Journal'', a quarterly publication containing descriptions of community-contributed commands and tips for the effective use of Stata. In 1994, a listserv began as a hub for users to collaboratively solve coding and technical issues; in 2014, it was converted into a web forum. In 1995, Statacorp began organizing user and developer conferences that meet annually. Only the annual Stata Conference held in the United States is hosted by StataCorp. Other user group meetings are held annually in the United States (the Stata Conference), the UK, Germany, and Italy, and less frequently in several other countries. Local Stata distributors host User Group meetings in their own countries.
{| class="wikitable mw-collapsible mw-collapsed" |+ class="nowrap" | Table: Releases and Development of Stata ! scope="col" | Version ! scope="col" | Release date ! scope="col" | Select new or enhanced features |- | 1.0 || January 1985 || * Initial release * Forty-four commands |- | 1.1 || February 1985 || * Bug fixes |- | 1.2 || May 1985 || * New menu system * Better online help * <code>keep</code> |- | 1.3 || August 1985 || * Stata/Graphics * <code>program</code> |- | 1.4 || August 1986 || * New documentation * Formatted <code>infile</code> |- | 1.5 || February 1987 || * <code>anova</code> * <code>logit</code>, <code>probit</code> |- | 2.0 || June 1988 || * New graphics * String variables * Survival analysis: Cox and Kaplan-Meier * Stepwise regression |- | 2.1 || September 1990 || * Byte variables * Factor analysis * ado-files * <code>reshape</code> |- | 3.0 || March 1992 || * <code>logistic</code>, <code>ologit</code>, <code>oprobit</code>, <code>clogit</code>, <code>mlogit</code> * <code>tobit</code>, <code>cnreg</code>, <code>rreg</code>, <code>qreg</code>, <code>weibull</code>, <code>ereg</code> * <code>epitab</code> * <code>pweights</code> |- | 3.1 || August 1993 || * <code>mvreg</code>, <code>sureg</code>, <code>heckman</code>, <code>nlreg</code>, <code>areg</code>, <code>canon</code> * <code>nbreg</code> * constrained linear regression * <code>ml</code> * <code>codebook</code> |- | 4.0 || January 1995 || * <code>xtreg</code> * <code>glm</code> |- | 5.0 || October 1996 || * <code>xtgee</code>, <code>xtprobit</code> * <code>prais</code>, <code>newey</code>, <code>intreg</code> * survey estimation commands * <code>fracpoly</code> * <code>st</code> extended |- | 6.0 || January 1999 || * web aware * new <code>ml</code> * time-series operators * <code>arima</code>, <code>arch</code> * <code>st</code> rewritten |- | 7.0 || December 2000 || * <code>frailty</code> * <code>xtabond</code> * cluster analysis * <code>nlogit</code> * <code>roc</code> * SMCL |- | 8.0 || January 2003 || * graphics * extended GUI, dialog boxes available for all commands * <code>manova</code> * more survey * more time series (VARs, SVARs) * more GLLAMM internalization |- | 8.1 || July 2003 || * updated <code>ml</code> |- | 8.2 || October 2003 || * graphics changes |- | 9.0 || April 2005 || * mata matrix programming language * survey features * linear mixed models * multinominal probit models |- | 9.1 || September 2005 || |- | 9.2 || April 2006 || |- | 10.0 || June 2007 || * graph editor * logistic and Poisson models with complex, nested error components |- | 10.1 || August 2008 || |- | 11.0 || July 2009 || * factor variables * <code>margins</code> postestimation command * multiple imputation |- | 11.1 || June 2010 || |- | 11.2 || March 2011 || |- | 12.0 || July 2011 || * automatic memory management * structural equation modeling |- | 12.1 || January 2012 || |- | 13.0 || June 2013 || * long strings * treatment effects |- | 13.1 || October 2013 || |- | 14.0 || April 2015 || * unicode support * Bayesian statistical analysis |- | 14.1 || October 2015 || |- | 14.2 || September 2016 || |- | 15.0 || June 2017 || * latent class analysis * PDF and Word documents * color transparency or opacity in graphs |- | 15.1 || November 2017 || |- | 16.0 || June 2019 || * frames (multiple datasets in memory) * lasso regression * automated reporting * updated choice models |- | 16.1 || February 2020 || |- | 17.0 || April 2021 || * updated <code>tables</code> command * bayesian econometrics |- |18.0 |April 2023 | * Bayesian model averaging * causal mediation analysis * heterogeneous difference-in-differences |}
== Software products ==
There are four builds of Stata: Stata/MP, Stata/SE, Stata/BE, and Numerics by Stata.<ref name="statabuild">{{cite web |title=Which Stata is right for me? |url=https://www.stata.com/products/which-stata-is-right-for-me/ |website=Stata: Software for Statistics and Data Science |access-date=23 April 2021}}</ref> Whereas Stata/MP allows for built-in parallel processing of certain commands, Stata/SE and Stata/BE are bottlenecked and limit usage to only one single core.<ref name = "hbsparallel">{{cite web |url = https://grid.rcs.hbs.org/parallel-stata |title= Parallel Stata |publisher = Harvard Business School}}</ref> Stata/MP runs certain commands about 2.4 times faster, roughly 60% of theoretical maximum efficiency, when running parallel processes on four CPU cores compared to SE or BE versions.<ref name = "hbsparallel" /> Numerics by Stata allows for web integration of Stata commands.
SE and BE versions differ in the amount of memory datasets may utilize. Though Stata/MP can store 10 to 20 billion observations and up to 120,000 variables, Stata/SE and Stata/BE store up to 2.14 billion observations and handle 32,767 variables and 2,048 variables respectively. The maximum number of independent variables in a model is 65,532 variables in Stata/MP, 10,998 variables in Stata/SE, and 798 variables in Stata/BE.<ref name="statabuild" />
The pricing and licensing of Stata depends on its intended use: business, government/nonprofit, education, or student. Single user licenses are either renewable annually or perpetual. Other license types include a single license for use by concurrent users, a site license, volume single user for bulk pricing, or a student lab.<ref>{{cite web |title=Order Stata software |url=https://www.stata.com/order/dl/ |website=Stata: Software for Statistics and Data Science |publisher=StataCorp |access-date=25 April 2021}}</ref>
== Example code ==
The following set of commands revolve around simple data management.<ref>{{cite book |title=Getting Started with Stata for Windows |publisher=Stata Press |location=College Station, TX |isbn=1-59718-334-2 |pages=1–19 |edition=Release 17 |url=https://www.stata.com/manuals/gsw.pdf |access-date=25 April 2021}}</ref>
<syntaxhighlight lang="stata"> sysuse auto // Open the included auto dataset browse // Browse the dataset (opens the Data Editor window)
describe // Describes the dataset and associated variables summarize // Summary information about numerical variables
codebook make foreign // Summary information about the make (string) and foreign (numeric) variables
browse if missing(rep78) // Browse only observations with missing data for variable rep78 list make if missing(rep78) // List makes of the cars with missing data for variable rep78 </syntaxhighlight>
The next set of commands move onto descriptive statistics.
<syntaxhighlight lang="stata"> summarize price, detail // Detailed summary statistics for variable price
tabulate foreign // One-way frequency table for variable foreign tabulate rep78 foreign, row // Two-way frequency table for variables rep78 and foreign
summarize mpg if foreign == 1 // Summary information about mpg if the car is foreign (the "==" sign tests for equality) by foreign, sort: summarize mpg // As above, but using the "by" prefix. tabulate foreign, summarize(mpg) // As above, but using the tabulate command. </syntaxhighlight>
A simple hypothesis test:
<syntaxhighlight lang="stata"> ttest mpg, by(foreign) // T-test for difference in means for domestic vs. foreign cars </syntaxhighlight>
Graphing data:
<syntaxhighlight lang="stata"> twoway (scatter mpg weight) // Scatter plot showing relationship between mpg and weight twoway (scatter mpg weight), by(foreign, total) // Three graphs for domestic, foreign, and all cars </syntaxhighlight>
Linear regression:
<syntaxhighlight lang="stata"> generate wtsq = weight^2 // Create a new variable for weight squared regress mpg weight wtsq foreign, vce(robust) // Linear regression of mpg on weight, wtsq, and foreign predict mpghat // Create a new variable contained the predicted values of mpg twoway (scatter mpg weight) (line mpghat weight, sort), by(foreign) // Graph data and fitted line </syntaxhighlight>
thumb|none|Regression graphs from auto dataset in Stata 17
== See also == * List of statistical packages * Comparison of statistical packages * Data analysis * Descriptive statistics
== References == {{Reflist}}
== Further reading == * {{cite book |author-first=Felix |author-last=Bittmann |title=Stata - A Really Short Introduction |location=Boston |publisher=DeGruyter Oldenbourg |year=2019 |isbn=978-3-11061-729-0 |url=https://books.google.com/books?id=nGOMDwAAQBAJ&q=stata+bittmann&pg=PP1 }} * {{cite book |editor-first=Enrique |editor-last=Pinzon |title=Thirty Years with Stata: A Retrospective |location=College Station, Texas |publisher=Stata Press |year=2015 |isbn=978-1-59718-172-3 |url=https://books.google.com/books?id=-9ARswEACAAJ }} * {{cite book |author-first=Lawrence C. |author-last=Hamilton |title=Statistics with STATA |location=Boston |publisher=Cengage |year=2013 |isbn=978-0-84006-463-9 |url=https://books.google.com/books?id=pUELAAAAQBAJ&pg=PP1 }}
== External links == {{Sister project links|d=Q1204300|c=category:Stata|n=no|v=no|wikt=no|voy=no|mw=no|m=no|species=no|s=no|q=no}} *{{Official website|https://www.stata.com/}} * [http://www.stata-journal.com/ Stata Journal] * [http://www.stata-press.com/ Stata Press] * [https://www.stata.com/products/stb/ Stata Technical Bulletin] * [http://repec.org/bocode/s/sscsubmit.html Statistical Software Components Archive]
{{Statistical software}} {{Authority control}}
Category:1985 software Category:Proprietary software programmed in C Category:Proprietary commercial software for Linux Category:Science software for Linux Category:Data mining and machine learning software Category:Statistical software Category:Statistical programming languages Category:Econometrics software Category:Time series software Category:Data warehousing Category:Extract, transform, load tools Category:Mathematical optimization software Category:Numerical software