📄 whatsnew6to7.hlp
字号:
{p 4 4}
All the old functions still exist, but in two cases, they work only under
version control: The old {cmd:invt()}, under the new naming logic, ought to
be the inverse of the cumulative, but is not, so {cmd:invt()} goes into forced
retirement for a release or two. It works if {cmd:version} is set to 6 or
before; otherwise, you get the error "unknown function invt()". Similarly,
the old {cmd:invchi()} goes into forced retirement because it is too close to
the new name {cmd:invchi2()}.
{hline}
{title:Nonstatistical improvements}
{title:Graphics}
{p 4 4}
Stata's {cmd:graph} command now allows line styles. Whereas before you might
have specified {cmd:c(lls)} on the {cmd:graph} command to indicate the first
variable was to be connected by lines, the second variable was to be
connected by lines, and the third variable was to be connected by a cubic
spline, you can now specify things like {cmd:c(l l[-] s[-.])} to indicate
the same thing and to also specify the style of the lines used to show the
result. The first is to be shown by a solid line, the second by a dashed
line, and the third by a line in a dash-dot-dash-dot pattern.
{p 4 4}
You can still specify the old style, or mix old and new style. In the square
brackets you can type a pattern which is made up of the following pieces:
{p 16 21}{cmd:l}{space 4}(el) solid line (default){p_end}
{p 16 21}{cmd:_}{space 4}(underscore) a long dash{p_end}
{p 16 21}{cmd:-}{space 4}(hyphen) a medium dash{p_end}
{p 16 21}{cmd:.}{space 4}(period) a short dash (almost a dot){p_end}
{p 16 21}{cmd:#}{space 4}(pound sign) a space
{p 4 4}
The pattern you specify repeats.
{p 4 4}
The keys at the top of graphics have been improved -- they now show the line
style as well as the point, and you can now exercise control over the keys
with the new {cmd:key1()}, {cmd:key2()}, {cmd:key3()}, and {cmd:key4()}
options. The {cmd:key}{it:#}{cmd:()} options allow you to specify the text,
the symbol, the line style, and the color, in any combination.
{cmd:key1(c(l[.-]) s(x) p(2) "Explanatory text")} creates a key displaying
a dot-dash-dot-dash line pattern, symbol small x ({cmd:symbol(x)} is new), in
the color of pen 2, with the text "Explanatory text".
{p 4 4}
You can now specify {cmd:xsize(}{it:#}{cmd:)} and {cmd:ysize(}{it:#}{cmd:)}
options on {cmd:graph} (and with the programming command {cmd:gph open}).
These specify the size of the graph, in inches, and take effect when you print
the graph. The default is {cmd:xsize(6)} and {cmd:ysize(4)}.
{p 4 4}
Printing is now a little different. Because Stata 7 now includes a windowed
interface for all operating systems, Unix included, you can pull down
{hi:File} and choose {hi:Print Graph}. You can also use the new {cmd:print}
command; see help {help print}. The {cmd:translate} command can translate
from .gph format to other file formats.
{p 4 4}
Compared to previous versions, this means the Unix stand-alone executables
gphdot and gphpen are now gone; you do not need them. {cmd:print} is better.
This also means the old {cmd:gphprint} command of Stata, available under
Windows and Macintosh only, is also supplanted for printing by {cmd:print}
and for file translation by {cmd:translate}.
{p 4 4}
The .gph file format has changed, meaning Stata 6 cannot display or print
Stata 7 .gph files (but Stata 7 can display and print Stata 6 files). The
old Stage editor cannot edit Stata 7 graphs.
{p 4 4}
The line-by-line console version of Stata for Unix can no longer display
graphs, although the {cmd:graph} command works in the sense that you can
graph into a file and print the results. To see graphs on the screen, you
must use the windowed version of Stata.
{p 4 4}
The programmer's command {cmd:gph} continues unmodified, but programmers are
alerted that Stata 7 has a new programmable bottom-layer graphics engine.
You may wish to code your graphics programs using this new feature and, if
so, point your browser at
{center:{browse "http://developer.stata.com/graphics"}}
{p 4 4}
Documentation for the new developmental system resides there.
{p 4 4}
Note: Your copy of Stata may have new graphic features not listed here. New
features might be added when you type {cmd:update} to obtain and install the
latest updates from www.stata.com. To find out about any new graphics
features see help {help whatsnew}. Help {help whatsnew}
gives a complete list of all new features, graphics and otherwise, provided
by your current update. Help {help graphics} will document new end-user
graphics features that are added through the life of Version 7.
{title:New commands}
{p 4 4}
{cmd:foreach} is a new programming command, but it can be used directly and is
a useful alternative to {cmd:for} and {cmd:while}. With {cmd:foreach}, you
can type things such as
{cmd:. foreach file in this.dta that.dta theother.dta {c -(}}
{cmd:2. use `file', clear}
{cmd:3. replace bp=. if bp==999}
{cmd:4. save `file', replace}
{cmd:5. {c )-}}
{p 4 4}
See help {help foreach}.
{p 4 4}
Likewise, the new {cmd:forvalues} programming command is a useful alternative
to {cmd:for} and {cmd:while} that steps through numeric values. Instead of
coding
{cmd:. local i = 1}
{cmd:. while `i' <= `n' {c -(}}
{cmd:2.} {it:...} {cmd:`i'} {it:...}
{cmd:3. local i = `i' + 1}
{cmd:4. {c )-}}
{p 4 4}
you code
{cmd:. forvalues i = 1(1)`n' {c -(}}
{cmd:2.} {it:...} {cmd:`i'} {it:...}
{cmd:3. {c )-}}
{p 4 4}
See help {help forvalues}.
{p 4 4}
{cmd:continue} (and {cmd:continue, break}) allow you to continue out of, or
break out of, {cmd:while}, {cmd:forvalues}, and {cmd:foreach} loops; see
help {help continue}.
{p 4 4}
{cmd:net} {cmd:search} searches the web for user-written additions to Stata,
including, but not limited to, user-written additions published in the STB.
The user-written materials found are available for immediate download and
automatic installation by clicking on the link. {cmd:net} {cmd:search} is the
latest incarnation of {cmd:webseek}, a command not included in Stata 6 but
which was made available during the release, and which continues to work but
is now undocumented. See help {help net}.
{p 4 4}
{cmd:destring} makes converting variables from string to numeric easier. See
help {help destring}.
{p 4 4}
The following new {cmd:egen} functions have been added: {cmd:any()},
{cmd:concat()}, {cmd:cut()}, {cmd:eqany()}, {cmd:ends()}, {cmd:kurt()},
{cmd:mad()}, {cmd:mdev()}, {cmd:mode()}, {cmd:neqany()}, {cmd:pc()},
{cmd:seq()}, {cmd:skew()}, and {cmd:tag()}. In addition, {cmd:group()} and
{cmd:rank()} have new options. See help {help egen}.
{p 4 4}
{cmd:statsby} creates a dataset of the results of a command executed
{cmd:by} {it:varlist}{cmd::}. The results can be any of the saved results of
the specified command and, if it is an estimation command, the coefficients
and the standard errors. Typing
`{cmd:statsby "regress mpg weight" _b _se e(r2), by(foreign)}', for instance,
would create a two-observation dataset in which the first recorded the
coefficients, standard error, and R^2 for foreign = 0, and the second recorded
them for foreign = 1. See help {help statsby}.
{p 4 4}
{cmd:xi} has been modified to exploit Stata's longer variable names to create
more readable names for the interaction terms. See help {help xi}.
{p 4 4}
{cmd:hexdump} will give you a hexadecimal dump of a file. Even more useful is
its {cmd:analyze} option, which will analyze the dump for you and report just
the summary. This can be useful for diagnosing problems with raw datasets.
See help {help hexdump}.
{p 4 4}
{cmd:type} has a new {cmd:asis} option. The default behavior of {cmd:type}
has been changed when the filename ends in {hi:.smcl} to interpret the SMCL
codes. This way, if you previously created a session log by typing
`{cmd:log using mylog}', you can type `{cmd:type mylog.smcl}' to display it as
you probably want to see it. If you wanted to see the raw SMCL codes,
you would type `{cmd:type mylog.smcl, asis}'. See help {help type}.
{p 4 4}
{cmd:net} {hi:stata.toc} and {hi:*.pkg} files now allow the {cmd:v} directive.
You are supposed to code `{cmd:v 2}' at the top of the files and, if you do
that, you may use SMCL directives in the files; see help {help net} and
{help smcl}.
{p 4 4}
{cmd:format} now allows you to type the {cmd:%}{it:fmt} first or last, so you
can equally well type `{cmd:format mpg weight %9.2f}' or
`{cmd:format %9.2f mpg weight}'. See help {help format}.
{p 4 4}
{cmd:version} may now be used as a prefix command; you can type
`{cmd:version 6: }{it:...}' to mean that {it:...} is to be run under version 6.
See help {help version}.
{p 4 4}
There are now three {cmd:shell}-like commands, depending on your operating
system: {cmd:shell}, {cmd:xshell}, and {cmd:winexec}. Stata for Window's
users: nothing has changed. Stata for Macintosh users: nothing has changed.
Stata(console) for Unix users: nothing has changed. Stata(GUI) for Unix,
however, is more complicated, and it all has to do with whether you want a new
{hi:xterm} window created for the application. See help {help shell}.
{p 4 4}
Numlists may now be specified as {it:a}{cmd:[}{it:b}{cmd:]}{cmd:c} as well as
{it:a}{cmd:(}{it:b}{cmd:)}{it:c}. See help {help numlist}.
{p 4 4}
{cmd:list} now has a {cmd:doublespace} option. See help {help list}.
{p 4 4}
{cmd:confirm} {cmd:names} verifies that what follows, follows Stata's naming
syntax -- which is to say, starts with a letter or underscore and thereafter
contains letters, underscores, or digits -- and is not too long.
{p 4 4}
{cmd:estimates} {cmd:hold} has two new options and one new behavior that will
be of interest to programmers. The new behavior is that if estimates are
held under a temporary name, they are now automatically discarded when the
program terminates. The new {cmd:restore} option schedules the held estimates
for automatic restoration on program termination. The new {cmd:not} option
to {cmd:estimates} {cmd:unhold} cancels the previously scheduled restoration.
The new {cmd:copy} option to {cmd:estimates} {cmd:hold} copies the current
estimates rather than moving them. See help {help estimates}.
{p 4 4}
{cmd:_rmcoll} and {cmd:_rmdcoll} assist in removing collinear variables from
varlists; see help {help _rmcoll} and {help _rmdcoll}.
{title:New string functions}
{p 4 4}
There are four new string functions: {cmd:match()}, {cmd:subinstr()},
{cmd:subinword()}, and {cmd:reverse()}.
{p 4 4}
{cmd:match(}{it:s_1}{cmd:,}{it:s_2}{cmd:)} returns 1 if string {it:s_1}
"matches" {it:s_2}. In the match, {cmd:*} in {it:s_2} is understood to mean
zero or more characters go here, and {cmd:?} is understood to mean one
character goes here. {cmd:match("this","*hi*")} is true. In {it:s_2},
{cmd:\\}, {cmd:\?}, and {cmd:\*} can be used if you really want a {cmd:\},
{cmd:?}, or {cmd:*} character.
{p 4 4}
{cmd:subinstr(}{it:s_1}{cmd:,}{it:s_2}{cmd:,}{it:s_3}{cmd:,}{it:n}{cmd:)} and
{cmd:subinword(}{it:s_1}{cmd:,}{it:s_2}{cmd:,}{it:s_3}{cmd:,}{it:n}{cmd:)}
substitute the first {it:n} occurrences of {it:s_2} in {it:s_1} with {it:s_3}.
{cmd:subinword()} restricts "occurrences" to be occurrences of words. In
either, {it:n} may be coded as missing value, meaning to substitute all
occurrences. For instance, {cmd:subinword("measure me","me","you",.)} returns
"measure you", and {cmd:subinstr("measure me","me","you",.)} returns "youasure
you".
{p 4 4}
{cmd:reverse(}{it:s}{cmd:)} returns {it:s} turned around.
{cmd:reverse("string")} returns "gnirts".
{p 4 4}
A fifth new string function is really intended for programmers:
{cmd:abbrev(}{it:s}{cmd:,}{it:n}{cmd:)} returns the {it:n}-character
{cmd:~}-abbreviation of the variable name {it:s}.
{cmd:abbrev(}{it:s}{cmd:,12)} is the function used throughout Stata to make
32-character names fit into 12 spaces.
{p 4 4}
See help {help functions}.
{title:Other new functions}
{p 4 4}
The new functions {cmd:inrange()} and {cmd:inlist()} make choosing the right
observations easier.
{p 4 4}
{cmd:inrange()} handles missing values elegantly when selecting subsamples
such as {bind:{it:a} <= {it:x} <= {it:b}}.
{cmd:inrange(}{it:x}{cmd:,}{it:a}{cmd:,}{it:b}{cmd:)} answers the question,
"Is {it:x} known to be in the range {it:a} to {it:b}?" Obviously,
{cmd:inrange(.,1000,2000)} is false. {it:a} or {it:b} may be missing.
{cmd:inrange(}{it:x}{cmd:,}{it:a}{cmd:,.)} answers whether it is known that
{bind:{it:x} >= {it:a}}, and {cmd:inrange(}{it:x}{cmd:,.,}{it:b}{cmd:)} answers
whether it is known that {bind:{it:x} <= {it:b}}. {cmd:inrange(.,.,.)}
returns 0 which, if you think about it, is inconsistent but is probably what
you want.
{p 4 4}
{cmd:inlist(}{it:x}{cmd:,}{it:a}{cmd:,}{it:b}{cmd:,}{it:...}{cmd:)} selects
observations if {bind:{it:x} = {it:a}} or {bind:{it:x} = {it:b}} or {it: ...}.
{p 4 4}
See help {help functions} for more information on the above functions. Other
functions have been added. {cmd:_by()}, {cmd:_bylastcall()}, and
{cmd:_byindex()} deal with making programs and ado-files allow the
{cmd:by} {it:varlist}{cmd::} prefix; see help {help byprog}.
{p 4 4}
The new macro extended function:
{c -(}{cmd:r}|{cmd:e}|{cmd:s}{c )-}{cmd:(}{c -(}{cmd:scalars}|{cmd:macros}|{cmd:matrices}|{cmd:functions}{c )-}{cmd:)}
returns the names of all the saved results of the indicated type. For
instance, {cmd:local x : e(scalars)} returns the names of all the scalars
currently stored in {cmd:e()}. See help {help macro}.
{hline 3} {hi:previous updates} {hline}
{pstd}
See {help whatsnew6}.
{hline}
{title:Also see}
{psee}
Online: {help whatsnew}
{p_end}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -