version.hlp

来自「是一个经济学管理应用软件 很难找的 但是经济学学生又必须用到」· HLP 代码 · 共 542 行 · 第 1/2 页

HLP
542
字号
{smcl}
{* 25mar2005}{...}
{cmd:help version}
{hline}

{title:Title}

{p 4 21 2}
{hi:[P] version} -- Version control


{title:Syntax}

	{cmdab:vers:ion}

	{cmdab:vers:ion} {it:#}[{cmd:,} {cmd:born(}{it:ddMONyyyy}{cmd:)} {cmdab:mis:sing}]

	{cmdab:vers:ion} {it:#}[{cmd:,} {cmd:born(}{it:ddMONyyyy}{cmd:)} {cmdab:mis:sing}]{cmd::}  {it:command}


{title:Description}

{pstd}
PROBLEM:  Stata is continually being improved, meaning programs and do-files
written for older versions might stop working.

{pstd}
SOLUTION:  Specify the version of Stata you are using at the top of
programs and do-files that you write:

	{hline 42} myprog.do {hline 3}
	{cmd:version {ccl stata_version}}

	use mydata, clear
	regress ...
	...
	{hline 42} myprog.do {hline 3}


	{hline 40} example.ado {hline 3}
	program myprog
		{cmd:version {ccl stata_version}}
		...
	end
	{hline 40} example.ado {hline 3}

{pstd}
Future versions of Stata will then continue to interpret your programs
correctly.

{pstd}
In the first syntax,

	{cmdab:vers:ion}

{pstd}
{cmd:version} shows the current version number to which the command
interpreter is set.

{pstd}
In the second syntax,

	{cmdab:vers:ion} {it:#}[{cmd:,} {cmd:born(}{it:ddMONyyyy}{cmd:)} {cmdab:mis:sing}]

{pstd}
{cmd:version} sets the command interpreter to internal
version number {it:#}.  {cmd:version} {it:#} 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.

{pstd}
In the third syntax,

	{cmdab:vers:ion} {it:#}[{cmd:,} {cmd:born(}{it:ddMONyyyy}{cmd:)} {cmdab:mis:sing}]{cmd::}  {it:command}

{pstd}
{cmd:version} executes {it:command} under version {it:#} and then resets the
version back to what it was before the {cmd:version} {it:#}{cmd::}{it:...}
command was given.


{title:Options}

{phang}
{cmd:born(}{it:ddMONyyyy}{cmd:)} is rarely specified and indicates that
    the Stata executable must
    be dated {it:ddMONyyyy} (e.g., 12May2003) or later.
    StataCorp sometimes writes programs in ado-files that require the Stata
    executable be of a certain date.  Since users could update ado-files
    without updating the executable, the {cmd:born()} option allows us to
    ensure that updated ado-code is not run with an older executable.

{pmore}
    Generally all that matters is the version number, so you would
    not use the {cmd:born()} option.  You use {cmd: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 {help whatsnew} to see
    the features added to the current version of Stata since its original
    release.

{phang}
{cmd:missing} requests the modern treatment of missing values.  {cmd:missing}
is allowed only when {it:#} is less than 8 (because otherwise, modern
treatment of missing values is implied.)

{pmore}
Before version 8, there was only one missing value ({cmd:.}).  To keep old
programs working, when {cmd:version} is less than 8, Stata acts as if {cmd:.}
= {cmd:.a} = {cmd:.b} = ... = {cmd:.z}.  Thus old lines, such as
"...{cmd:if x!=.}", continue to exclude all missing observations.

{pmore}
Specifying {cmd:missing} will cause old programs to break.  The only reason
to specify {cmd: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.


{title:Remarks}

{pstd}
All programs and do-files written using this version of Stata should include
"{cmd:version {ccl stata_version}}" as the first executable statement; for
example:

	    {cmd:program define mypgm}
		    {cmd:version {ccl stata_version}}
		    {it:etc.}
	    {cmd:end}

{pstd}
Programs and do-files written as of earlier releases should include the
appropriate {cmd:version} line at the top.  All programs distributed by
StataCorp have this.  Thus old programs work even if Stata has changed.


{title:Summary of version changes}

{pstd}
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 likely 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.

{* this happens as of Stata 10; set version 9 and old command -score-}{...}
{* that went with -factor- starts working again}{...}

    {title:If you set version to less than 9}

{phang2}1.  Command {helpb svyset} reverts to pre-Stata 9 syntax and logic.
            The dataset must be {cmd:svyset} by the pre-Stata 9 {cmd:svyset}
            command to use the pre-Stata 9 estimation commands 
		{cmd:svygnbreg},
		{cmd:svyheckman},
		{cmd:svyheckprob},
		{cmd:svyivreg},
		{cmd:svylogit},
		{cmd:svymlogit},
		{cmd:svynbreg},
		{cmd:svyologit},
		{cmd:svyoprobit},
		{cmd:svypoisson},
		{cmd:svyprobit},
		and
		{cmd:svyregress}.

{phang2}2.  Command {helpb factor}, command {helpb pca}, and related commands 
            revert to pre-Stata 9 behavior.

{p 12 12 2}
            To begin with, 
            commands {cmd:factor} and {cmd:pca} store things differently.
            Before Stata 9, these commands were a strange mix of e-class and
            r-class; they set {cmd:e(sample)} but otherwise mostly saved
            results in {cmd:r()}.  They also stored secret matrices under odd
            names that everyone knew about and fetched via {cmd:matrix get()}.
            All of that is restored.

{p 12 12 2}
            Secondly, command {cmd:factor,} {cmd:ml} {cmd:protect} uses a 
            different random-number generator, one that is not 
            settable by the more modern {cmd:factor}'s {cmd:seed()} option.

{p 12 12 2}
            Thirdly, 
            command {helpb rotate} reverts to pre-Stata 9 syntax and logic.

{p 12 12 2}
            Fourthly, 
            old command {cmd:score} stops issuing warning messages that it is
            out of date.

{p 12 12 2}
            Lastly, 
            old command {cmd:greigen} works as it used to work, syntax 
            and logic.  (As of Stata 9, {cmd:greigen} was undocumented and
            configured to call through to the modern {cmd:screeplot}.)

{phang2}3.  Command {helpb nl} reverts to pre-Stata 9 syntax.

{phang2}4.  Commands {helpb bootstrap}, {helpb bstat}, and {helpb jknife} 
            revert to pre-Stata 9 syntax and logic.

{phang2}5.  Command {helpb rocfit} reverts to pre-Stata 9 syntax and logic.

{phang2}6.  Command {helpb sw} reverts to pre-Stata 9 syntax and logic.

{phang2}7.  Command {helpb cluster dendrogram}
            reverts to pre-Stata 9 syntax and logic.

{phang2}8.  Pre-Stata 8 {it:(sic)} command {cmd:xthausman} 
            will work.  {cmd:xthausman} was replaced by {helpb hausman} in 
            Stata 8.

{p 8 12 2}
        9.  Commands {helpb irf graph} and {helpb xtline} allow option 
            {cmd:byopts()} to be
            abbreviated {cmd:by()} rather than requiring at least 
            {cmd:byop()}.

{p 7 12 2}
       10.  Command {helpb dotplot} will allow option {cmd:by()} as 
            a synonym for option {cmd:over()}.

{p 7 12 2}
       11.  Command {helpb glm} defaults option {cmd:iterate()} to 50 
            rather than {cmd:c(maxiter)}.

{p 7 12 2}
       12.  Command {helpb histogram} places white space below 
            horizontal axis.

{p 7 12 2}
       13.  Command {helpb ml:ml display} changes the look of 
            survey results.

{p 7 12 2}
       14.  Commands {helpb ologit} and {helpb oprobit}  revert 
	    to pre-Stata 9 logic in how {cmd:e(b)} and {cmd:e(V)} are 
            stored.  Results were stored in two equations, with all 
            cut points stored in the second.

{p 7 12 2}
       15.  Commands {helpb tobit} and {helpb cnreg}  revert 
	    to pre-Stata 9 logic in how {cmd:e(b)} and {cmd:e(V)} are 
            stored.  Results were stored in a single equation
            containing both coefficients and the ancillary variance 
            parameter.

{p 7 12 2}
       16.  Command {helpb tabstat} returns a result in matrix 
            {cmd:r(StatTot)} rather than {cmd:r(StatTotal)}.
 
{p 7 12 2}
       17.  Commands {helpb glogit} and {helpb 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, 
            {it:Econometric Analysis, 3d ed.}, 
	    Prentice-Hall, p. 896).

{p 7 12 2}
       18.  Commands 
		{helpb xtintreg},

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?