help version
-------------------------------------------------------------------------------
Title
[P] version -- Version control
Syntax
Show version number to which command interpreter is set
version
Set command interpreter to version #
version #[, born(ddMONyyyy) missing]
Execute command under version #
version #[, born(ddMONyyyy) missing]: command
Description
Problem: Stata is continually being improved, meaning that programs and
do-files written for older versions might stop working.
Solution: Specify the version of Stata that you are using at the top of
programs and do-files that you write:
--------------------------------- begin myprog.do ---
version 11
use mydata, clear
regress ...
...
----------------------------------- end myprog.do ---
------------------------------- begin example.ado ---
program myprog
version 11
...
end
--------------------------------- end example.ado ---
Future versions of Stata will then continue to interpret your programs
correctly.
In the first syntax,
version
version shows the current version number to which the command interpreter
is set.
In the second syntax,
version #[, born(ddMONyyyy) missing]
version sets the command interpreter to internal version number #.
version # allows old programs to run correctly under more recent versions
of Stata and ensures that new programs will run correctly under future
versions of Stata.
In the third syntax,
version #[, born(ddMONyyyy) missing]: command
version executes command under version # and then resets the version to
what it was before the version #:... command was given.
Options
born(ddMONyyyy) is rarely specified and indicates that the Stata
executable must be dated ddMONyyyy (e.g., 13Jul2009) or later.
StataCorp and users sometimes write programs in ado-files that
require the Stata executable to be of a certain date. The born()
option allows us or the author of an ado-file to ensure that ado-code
that requires a certain updated executable is not run with an older
executable.
Generally all that matters is the version number, so you would not
use the born() option. You use born() in the rare case that you are
exploiting a feature added to the executable after the initial
release of that version of Stata. See whatsnew to browse the
features added to the current version of Stata since its original
release.
missing requests the modern treatment of missing values. missing is
allowed only when # is less than 8 (because otherwise, modern
treatment of missing values is implied).
Before version 8, there was only one missing value (.). To keep old
programs working, when version is less than 8, Stata acts as if . =
.a = .b = ... = .z. Thus old lines, such as "...if x!=.", continue
to exclude all missing observations.
Specifying missing will cause old programs to break. The only reason
to specify missing is that you want to update the old program to
distinguish between missing-value codes and you do you want to update
it to be modern in other ways. Few, if any, programs need this.
Remarks
All programs and do-files written using this version of Stata should
include "version 11" as the first executable statement. For example:
program mypgm
version 11
etc.
end
Programs and do-files written as of earlier releases should include the
appropriate version line at the top. All programs distributed by
StataCorp have this. Thus old programs work even if Stata has changed.
Summary of version changes
There have been many changes made to Stata over the years. Most do not
matter in the sense that they will not break old programs even if the
version is not set correctly. However, some changes in Stata will break
old programs unless the version number is set back to the appropriate
version number. The list below outlines these important changes. This
list is probably of interest only to those trying to update an old
program to a new version's syntax -- most people will just set the
version number appropriately instead and not worry about any of this.
If you set version to less than 11.0
1. anova reverts to pre-Stata 11 syntax. Options category(),
class(), continuous(), regress, anova, noanova, and detail are
allowed, while factor-variable notation (the i. and c.
operators) is not allowed. The * symbol indicates interaction
(instead of #), and therefore *, -, and ? are not allowed for
variable-name expansion. Noninteger and negative values are
allowed as category levels.
2. correlate's _coef option is allowed.
3. ereturn display ignores the scalars in e(). As of version 11,
ereturn display checks the value of scalar e(k_eq) contains the
number of equations in e(b) if it is set.
4. manova reverts to pre-Stata 11 syntax. Options category(),
class(), continuous(), and detail are allowed, while
factor-variable notation (the i. and c. operators) is not
allowed. The * symbol indicates interaction (instead of #), and
therefore *, -, and ? are not allowed for variable-name
expansion. Noninteger and negative values are allowed as
category levels.
5. odbc insert will insert data by constructing an SQL insert
statement and will not use parameterized inserts.
6. odbc load will quote the table name used in the SQL SELECT
statement that loads your data unless the noquote option is used.
7. outfile will not export date-formatted variables as strings.
8. predict options scores and csnell after stcox will produce
partial, observation-level diagnostics instead of subject-level
diagnostics. This matters only if you have multiple records per
subject in your survival data.
9. Abbreviating predict option scores with sc after stcox is
allowed. Modern syntax requires sco minimally.
10. predict options mgale and csnell after streg will produce
partial, observation-level diagnostics instead of subject-level
diagnostics. This matters only if you have multiple records per
subject in your survival data.
11. Abbreviating predict option csnell with cs after streg is
allowed. Modern syntax requires csn minimally.
12. xtreg , re vce(robust) uses the Huber/White/sandwich estimator of
the variance-covariance of the estimator (VCE). As of version
11, xtreg , re vce(robust) is equivalent to xtreg , re
vce(cluster panelvar), where panelvar identifies the panels.
If you set version to less than 10.1
1. Binomial() function is allowed. The modern replacement for
Binomial() is binomialtail().
2. canon will display raw coefficients and conditionally estimated
standard errors and confidence intervals in a standard estimation
table by default, rather than raw coefficients in matrix form.
3. drawnorm uses invnormal(uniform()) to generate normal random
variates instead of using rnormal().
4. egen function mode() with option missing will not treat missing
values as a category.
5. The reshape J variable value and variable labels and all xij
variable labels, when reshaping from long to wide and back to
long, will not be preserved.
6. xtmixed, xtmelogit, and xtmepoisson, without an explicit level
variable (or _all) followed by a colon in the random-effects
specification, assume a specification of _all:.
If you set version to less than 10
1. ca and camat, instead of reporting percent inertias, report
inertias such that their sums equal the total inertia.
2. cf, verbose produces the same output as cf, all.
3. Command clear will perform the same list of actions as clear all,
except for program drop _all.
4. Commands cnreg and tobit will no longer accept the vce() option.
5. datasignature runs _datasignature, which is what the
datasignature command was in Stata 9.
6. Functions norm(), normd(), normden(), invnorm(), and lnfact()
that were renamed in Stata 9 are allowed. The corresponding
modern functions are normal(), normalden(), normalden(),
invnormal(), and lnfactorial().
7. graph use will name the graph and window Graph, rather than
naming after the filename, unless the option name() is specified.
8. mdslong's force option corrects problems with the supplied
proximity information and multiple measurements on (i,j) are
averaged. In version 10, measurements for (i,j) and (j,i) are
averaged if force is specified, but additional multiple
measurements result in an error even if force is specified.
9. mkspline calculates percentiles for linear splines using egen's
pctile() function instead of using the centile command. In
addition, fweights are not allowed for linear splines.
10. mlogit had the following name changes in its e() results:
old name new name
-------------------------------------
e(basecat) e(baseout)
e(ibasecat) e(ibaseout)
e(k_cat) e(k_out)
e(cat) e(out)
11. odbc load will import date-and-time variables as %td instead of
%tc and TIME data types will be imported as strings.
12. score, a command associated with the factor command of Stata 8,
is allowed.
13. Option risktable() of sts graph and option survival of sts list
are not allowed.
14. syntax [, whatever(real ...)] uses a %9.0g format instead of a
%18.0g format for the number placed in the whatever local macro.
15. xtabond will use the version 9 xtabond instead of xtdpd to
perform the computations, the output will be in differences
instead of levels and the constant will be a time trend instead
of a constant in levels. estat abond and estat sargan will not
work and predict will have the version 9 syntax.
16. xtlogit, xtprobit, xtcloglog, xtintreg, xttobit, xtpoisson,
normal random-effects models will use default
intmethod(aghermite).
If you set version to less than 9.2
1. Mata structures introduced in Stata 9.2 are available even if you
set version to less than 9.2. The only version control issue is
that the format of .mlib libraries is different. You do not need
to recompile old Mata code. However, because of the format
change, you will not be able to add new members to old libraries.
Libraries cannot contain a mix of old and new code. To add new
members, you must first rebuild the old library.
If you set version to less than 9.1
1. logit, probit, and dprobit will accept aweights. Support for
aweights was removed from these commands because the
interpretation of aweighted data is nonsensical for these models.
2. nl will not allow the vce() option; no longer reports each
parameter as its own equation; reports the previous sum of
squares after each iteration instead of the new sum of squares in
the iteration log; reports an overall model F test; allows fewer
predict options; and will not allow mfx or lrtest postestimation
commands.
3. permute uses one random uniform variable (instead of two) to
generate Monte Carlo permutations of the permute variable.
4. xtreg, fe adjusts the robust-cluster VCE for the within
transform.
5. xtreg, fe and xtreg, re do not require that the panels are nested
within the clusters when computing the cluster-robust VCE.
If you set version to less than 9
1. Command svyset reverts to pre-Stata 9 syntax and logic. The
dataset must be svyset by the pre-Stata 9 svyset command to use
the pre-Stata 9 estimation commands svygnbreg, svyheckman,
svyheckprob, svyivreg, svylogit, svymlogit, svynbreg, svyologit,
svyoprobit, svypoisson, svyprobit, and svyregress.
2. Command factor, command pca, and related commands revert to
pre-Stata 9 behavior.
To begin with, commands factor and pca store things differently.
Before Stata 9, these commands were a strange mix of e-class and
r-class; they set e(sample) but otherwise mostly saved results in
r(). They also stored secret matrices under odd names that
everyone knew about and fetched via matrix get(). All of that is
restored.
Second, command factor, ml protect uses a different random-number
generator, one that is not settable by the more modern factor's
seed() option.
Third, command rotate reverts to pre-Stata 9 syntax and logic.
Fourth, old command score stops issuing warning messages that it
is out of date.
Finally, old command greigen works as it used to work, syntax and
logic. (As of Stata 9, greigen was undocumented and configured
to call through to the modern screeplot.)
3. Command nl reverts to pre-Stata 9 syntax.
4. Commands bootstrap, bstat, and jknife revert to pre-Stata 9
syntax and logic.
5. Command rocfit reverts to pre-Stata 9 syntax and logic.
6. Command sw reverts to pre-Stata 9 syntax and logic.
7. Command cluster dendrogram reverts to pre-Stata 9 syntax and
logic.
8. Pre-Stata 8 [sic] command xthausman will work. xthausman was
replaced by hausman in Stata 8.
9. Commands irf graph and xtline allow option byopts() to be
abbreviated by() rather than requiring at least byop().
10. Command dotplot will allow option by() as a synonym for option
over().
11. Command glm defaults option iterate() to 50 rather than
c(maxiter).
12. Command histogram places white space below horizontal axis.
13. Command ml display changes the look of survey results.
14. Commands ologit and oprobit revert to pre-Stata 9 logic in how
e(b) and e(V) are stored. Results were stored in two equations,
with all cutpoints stored in the second.
15. Commands tobit and cnreg revert to pre-Stata 9 logic in how e(b)
and e(V) are stored. Results were stored in one equation
containing both coefficients and the ancillary variance
parameter.
16. Command tabstat returns a result in matrix r(StatTot) rather than
r(StatTotal).
17. Commands glogit and gprobit, the weighted-least-squares
estimators, use a different formula for the weights. In Stata 9,
a new (better) formula was adopted, see Greene (1997, Econometric
Analysis, 3rd ed., Prentice-Hall, p. 896).
18. Commands xtintreg, xtlogit, xtprobit, xtcloglog, xtpoisson, and
xttobit revert to using nonadaptive Gauss-Hermite quadrature
rather than adaptive quadrature. Also, option quad() (modern
name intpoints()) comes back to life.
19. Command set help will be allowed (but it will not do anything).
20. In input, \\ will be substituted to \ always, not just after the
macro-substitution characters $ and `.
If you set version to 8.1 or less
1. graph twoway default axis titles show the labels or variable
names for all variables plotted on an axis instead of leaving the
axis title blank when the axis represents multiple variables.
2. clogit will not allow the vce() option and many of the ml
maximize options.
If you set version to 8.0 or less
1. ml ignores the constraint() option if there are no predictors in
the first equation.
2. outfile automatically includes the extended missing-value codes
(.a, .b, ... .z) in its output. With version 8.1 or later,
extended missing-value codes are treated like the system missing
value . and are changed to null strings ("") unless the missing
and comma options are specified.
If you set version to 7.0 or less
1. graph uses the old syntax; see graph7.
2. estimates reverts to the previous interpretation and syntax, and
_estimates and ereturn are not recognized as Stata commands.
3. The svy commands allow the svyset parameters to be specified as
part of the command.
4. Also, the following commands revert to their old syntax: ac,
acprplot, avplot, avplots, bootstrap, bs, bsample, bstat, cchart,
cprplot, cumsp, cusum, dotplot, findit, fracplot, gladder,
greigen, grmeanby, histogram, intreg, kdensity, lowess, lroc,
lsens, ltable, lvr2plot, newey, pac, pchart, pchi, pergram,
pkexamine, pksumm, pnorm, qchi, qladder, qnorm, qqplot, quantile,
rchart, roccomp, rocplot, roctab, rvfplot, rvpplot, serrbar,
shewhart, simulate, spikeplot, stci, stcoxkm, stcurve, stphplot,
stphtest, strate, sts, symplot, tabodds, test, wntestb, xchart,
and xcorr. Most of these are because of the change of the graph
command.
5. Throughout Stata, . == .a == .b == ... == .z.
6. Missing values in matrices are less likely to be accepted.
7. generate x = string_expression will produce an error; you are
required to specify the type; see [D] generate.
8. if, while, foreach, forvalues, and other commands that use the
open and close braces, { and }, often allow the item enclosed in
the braces to appear on the same line as the braces.
9. test allows the coefficient names not to match 1 to 1 (regardless
of order) when testing equality of coefficients of two equations.
The test is performed on the coefficients in common.
10. list allows the doublespace option, which is then treated as if
it were the separator(1) option. Also, even with the version set
to 7.0 or less, list uses the new style of listing unless the
clean option is specified to remove the dividing and separating
lines.
11. outfile uses right justification for strings.
12. reldif(x,y) with x and y as equal missing values, such as
reldif(.r,.r), returns system missing (.) instead of 0.
13. query, in addition to showing all the settings normally shown,
shows the values of set parameters that apply only to the earlier
versions.
14. matrix score, when looking up variable names associated with the
elements of the specified vector, expands variable name
abbreviations.
15. xthausman continues to work (for one more release) but recommends
the use of hausman instead.
If you set version to 6.0 or less
1. Macro substitution is made on the basis of the first seven
(local) or eight (global) characters of the name; `thisthatwhat'
is the same as `thistha'.
2. syntax returns the result of parsing a long option name in the
local macro formed from the first seven characters of the option
name.
3. display starts in non-SMCL mode; may use in smcl directive to set
smcl mode on.
4. invt() works; invttail(a,(1-b)/2) is a new alternative to
invt(a,b).
5. invchi() works; invchi2(a,1-b) is a new alternative to
invchi(a,b).
6. post will allow expressions that are not bound in parentheses.
7. basehazard() option allowed in cox and stcox; renamed to
basehc(), which is understood regardless of version setting.
8. log using can have a noproc option.
9. log close, log off, and log on will close, turn off, or turn on a
cmdlog if present and a log is not.
10. set log linesize, set log pagesize, set display linesize, and set
display pagesize are allowed.
11. extended macro functions log, set log linesize, and set log
pagesize enabled.
12. insheet will recognize only the first eight characters of
variable names and will provide default names for variables if
the first eight characters are not unique.
13. jackknife (or jknife) will call the older STB version of the
command.
If you set version to 5.0 or less
1. date() defaults to 20th century for two-digit years.
2. predict becomes the built-in command equivalent to _predict.
3. , & \ matrix operators allow first matrix to not exist; now use
nullmat().
4. matrix ...=get(_b) returns a matrix instead of row vector after
mlogit.
5. test after anova understands the error() option instead of new
"/" syntax.
6. ologit and oprobit default weight types are aweights.
7. heckman default weight type is fweights.
8. svyregress, svylogit, and svyprobit compute meff and meft by
default.
[Note: For xtgee, xtpoisson, & xtprobit the default will not be
aweights as you would expect under version control; iweights
is the default despite setting the version number back to
5.0.]
If you set version to 4.0 or less
1. -2^2 = (-2)^2 = 4 (After 4.0: -2^2 = -(2^2) = -4)
2. describe sets the contents of _result() differently
3. merge does not automatically promote variables
4. logit and probit default weight types are aweights
5. set prefix shown by query
6. hareg, hereg, hlogit, hprobit, hreg commands work
7. collapse has old syntax
If you set version to 3.1 or less
1. uniform() refers to the old random-number generator
2. set seed sets the old random-number seed
3. replace defaults to nopromote behavior
4. old %macro notation is allowed (it no longer is)
If you set version to 3.0 or less
1. tempfiles are not automatically erased
If you set version to 2.5 or less
1. missing strings stored as "." by infile
If you set version to 2.1 or less
1. display does not respect quietly
2. macros hold numbers in short format
Using the old Stata 3.1 random-number generator
uniform() and set seed refer to the old Stata 3.1 random-number generator
if you set version 3.1 or earlier. You can also access the old
random-number generator even with version set to 11 by referring to
uniform0(). You can set the old random-number generator's seed by typing
set seed0 -- it works just like set seed; see seed. The initial seed of
the old random-number generator is set seed0 1001.
There is no reason you should want to use the old random-number
generator. It was satisfactory but the new one is better.
Also see
Manual: [P] version
Help: [D] functions, [D] generate (seed), [R] which, whatsnew