📄 creturn.hlp
字号:
{smcl}
{* 21mar2005}{...}
{cmd:help creturn} {right:dialog: {bf:{dialog creturn}}}
{hline}
{title:Title}
{p2colset 5 20 22 2}{...}
{p2col :{hi:[P] creturn} {hline 2}}Return c-class values{p_end}
{p2colreset}{...}
{title:Syntax}
{cmdab:cret:urn} {cmdab:l:ist}
{title:Description}
{pstd}
Stata's c-class, {cmd:c()}, contains the values of system parameters and
settings, along with certain constants, such as the value of pi. {cmd:c()}
values may be referenced but may not be assigned.
{title:System values}
{phang}
{cmd:c(current_date)} returns the current date as a string in the format
{bind:"{it:dd Mon yyyy}"}, where {it:dd} is the day of the month; {it:Mon}
is {cmd:Jan}, {cmd:Feb}, {cmd:Mar}, {cmd:Apr}, {cmd:May}, {cmd:Jun},
{cmd:Jul}, {cmd:Aug}, {cmd:Sep}, {cmd:Oct}, {cmd:Nov}, or {cmd:Dec}; and
{it:yyyy} is the year.
{phang2}
Examples:{break}
"{cmd:01 Jan 2003}"{break}
"{cmd:26 Mar 2003}"{break}
"{cmd:{ccl current_date}}"
{phang}
{cmd:c(current_time)} returns the current time as a string in the format
{bind:"{it:hh}{cmd::}{it:mm}{cmd::}{it:ss}"}, where {it:hh} is the hour 00
through 23, {it:mm} is the minute 00 through 59, and {it:ss} is the second
00 through 59.
{phang2}
Examples:{break}
"{cmd:09:42:55}"{break}
"{cmd:13:02:01}"{break}
"{cmd:{ccl current_time}}"
{phang}
{cmd:c(rmsg_time)} returns a numeric scalar equal to the elapsed time last
reported as a result of {cmd:set rmsg on}; see {helpb rmsg}.
{phang}
{cmd:c(stata_version)} returns a numeric scalar equal to the version of Stata
that you are running. In Stata {ccl stata_version}, this number is always
{ccl stata_version}. Note that this is the version of Stata that you are
running, not the version being mimicked by the {cmd:version} command.
{phang}
{cmd:c(version)} returns a numeric scalar equal to the version currently
set by the {cmd:version} command; see {helpb version}.
{phang}
{cmd:c(born_date)} returns a string in the same format as
{cmd:c(current_date)} containing the date of the Stata executable
you are running; see {helpb update}.
{phang}
{cmd:c(flavor)} returns a string containing "{cmd:Small}" or
"{cmd:Intercooled}" according to the version of Stata that you are
running. Note that {cmd:c(flavor)}=="{cmd:Intercooled}" for both
{help SpecialEdition:Stata/SE} and Intercooled Stata.
{phang}
{cmd:c(SE)} returns a numeric scalar equal to 1 if you are running
{help SpecialEdition:Stata/SE} and returns 0 otherwise.
{phang}
{cmd:c(mode)} returns a string containing "" or "{cmd:batch}", depending on
whether Stata was invoked in interactive mode (the usual case) or batch
mode (using, perhaps, the {cmd:-b} option of Stata for Unix).
{phang}
{cmd:c(console)} returns a string containing "" or "{cmd:console}", depending
on whether you are running a windowed version of Stata or Stata(console).
{phang}
{cmd:c(os)} returns a string containing "{cmd:Windows}", "{cmd:Unix}", or
"{cmd:MacOSX}", depending on the operating system that you are
using. Note that the list of alternatives, while complete as of the date
of this writing, may not be complete.
{phang}
{cmd:c(osdtl)} returns an additional string, depending on the operating
system, that provides the release number or other details about the
operating system. {cmd:c(osdtl)} is often "".
{phang}
{cmd:c(machine_type)} returns a string that describes the hardware platform,
such as "{cmd:PC}", "{cmd:Macintosh}", "{cmd:Sun SPARC}", etc.
{phang}
{cmd:c(byteorder)} returns a string containing "{cmd:lohi}" or "{cmd:hilo}",
depending on the byteorder of the hardware. Consider a two-byte integer.
On some computers, the most-significant byte is written first, so x'0001'
(meaning the byte 00 followed by 01) would mean the number 1. Such
computers are designated "{cmd:hilo}". Other computers write the
least-significant byte first, so x`0001' would be 256, and 1 would be
x'0100'. Such computers are designated "{cmd:lohi}".
{title:Directories and paths}
{pstd}
Note: the directory paths returned below usually end in a directory
separator, so if you wish to construct the full path name of file abc.def in
directory {cmd:c(}...{cmd:)}, you code
...{cmd:`c(}...{cmd:)'abc.def}...
{pstd}and not
...{cmd:`c(}...{cmd:)'/abc.def}...
{pstd}
If {cmd:c(}...{cmd:)} returns a directory name that does not end in a directory
separator, a special note is made.
{phang}
{cmd:c(sysdir_stata)} returns a string containing the name of the directory
(folder) in which Stata is installed. More technically,
{cmd:c(sysdir_stata)} returns the STATA directory as defined by
{cmd:sysdir}; see {helpb sysdir}.
{pin2}
Example: {cmd:{ccl sysdir_stata}}
{phang}
{cmd:c(sysdir_updates)} returns a string containing the name of the directory
(folder) in which Stata is to find the official ado-file updates. More
technically, {cmd:c(sysdir_updates)} returns the UPDATES directory as
defined by {cmd:sysdir}; see {helpb sysdir}.
{pin2}
Example: {cmd:{ccl sysdir_updates}}
{phang}
{cmd:c(sysdir_base)} returns a string containing the name of the directory
(folder) in which the original official ado-files that were shipped with
Stata were installed.
{pin2}
Example: {cmd:{ccl sysdir_base}}
{phang}
{cmd:c(sysdir_site)} returns a string containing the name of the directory
(folder) in which user-written additions may be installed for site-wide
use. More technically, {cmd:c(sysdir_site)} returns the SITE directory as
defined by {cmd:sysdir}; see {helpb sysdir}.
{pin2}
Example: {cmd:{ccl sysdir_site}}
{phang}
{cmd:c(sysdir_plus)} returns a string containing the name of the directory
(folder) in which additions written by others may be installed for
personal use. More technically, {cmd:c(sysdir_plus} returns the PLUS
directory, as defined by {cmd:sysdir}; see {helpb sysdir}.
{pin2}
Example: {cmd:{ccl sysdir_plus}}
{phang}
{cmd:c(sysdir_personal)} returns a string containing the name of the directory
(folder) in which additions written by you may be installed.
More technically, {cmd:c(sysdir_personal} returns the PERSONAL
directory, as defined by {cmd:sysdir}; see {helpb sysdir}.
{pin2}
Example: {cmd:{ccl sysdir_personal}}
{phang}
{cmd:c(sysdir_oldplace)} identifies another directory in which user-written
ado-files might be installed. {cmd:c(sysdir_oldplace)} maintains
compatibility with very ancient versions of Stata.
{phang}
{cmd:c(adopath)} returns a string containing the directories that are to be
searched when Stata attempts to locate an ado-file. The path elements are
separated by a semicolon ({cmd:;}), and the elements themselves may be
directory names, "{cmd:.}" to indicate the current directory, or
{helpb sysdir} references.
{pin2}
Example: {cmd:{ccl adopath}}
{phang}
{cmd:c(pwd)} returns a string containing the current (working) directory.
{pin2}
Example: {cmd:{ccl pwd}}
{pin2}
Note that {cmd:c(pwd)} does not end in a directory separator, so, in a
program, to save the name of the file abc.def prefixed by the current
directory (for example, because you were about to change directories and
still wanted to refer to the file), you would code
{cmd:local file "`c(pwd)'/abc.def"}
or
{cmd:local file "`c(pwd)'`c(dirsep)'abc.def"}
{pin2}
The second form is preferred if you want to construct "pretty" filenames,
but the first form is acceptable because Stata understands a forward
slash ({cmd:/}) as a directory separator.
{phang}
{cmd:c(dirsep)} returns a string containing "{cmd:/}".
{pin2}
Example: {cmd:{ccl dirsep}}
{pin2}
Note that, for Windows operating systems, a forward slash ({cmd:/}) is
returned rather than a backslash ({cmd:\}). Stata for Windows understands
both, but in programs, using a forward slash is recommended because a
backslash can interfere with Stata's interpretation of macro-expansion
characters. Do not be concerned if the result of your code is a mix
of backslash and forward-slash characters, such as \a\b/myfile.dta;
Stata will understand it just as it would understand /a/b/myfile.dta
or \a\b\myfile.dta.
{title:System limits}
{phang}
{cmd:c(max_N_theory)} and {cmd:c(max_N_current)} each return a numeric scalar
reporting the maximum number of observations allowed.
{cmd:c(max_N_theory)} and {cmd:c(max_N_current)} are seldom equal.
{pin2}
{cmd:c(max_N_theory)} reports the maximum number of observations that Stata
could process if it had enough memory. This is usually 2,147,483,647.
{pin2}
{cmd:c(max_N_current)} reports the maximum number of observations that Stata
can process given the current amount of memory allocated to Stata. You
can change the amount of memory and, hence, this number using the
{helpb memory:set memory} command.
{phang}
{cmd:c(max_k_theory)} and {cmd:c(max_k_current)} each return a numeric scalar
reporting the maximum number of variables allowed. {cmd:c(max_k_theory)}
returns the theoretical maximum number of variables allowed.
{cmd:c(max_k_current)} returns the current maximum possible considering the
number of observations you currently have in memory and may be the same as
or less than, but never more than, {cmd:c(max_k_theory)}. In the case of
Stata/SE, {cmd:c(max_k_theory)} is determined by the
{helpb maxvar:set maxvar} command.
{phang}
{cmd:c(max_width_theory)} and {cmd:c(max_width_current)} each return a numeric
scalar equal to the maximum width of an observation, which is defined as
the sum of the byte lengths of its individual variables. If you had a
dataset with 2 {help int} variables, 3 {help float}s, 1 {help double}, and
a {help data types:str20} variable, the width of the dataset would be 2*2 +
3*4 + 8 + 20 = 44 bytes.
{pin2}
{cmd:c(max_width_theory)} returns the theoretical maximum width allowed.
{cmd:c(max_width_current)} returns the current maximum possible considering
the number of observations you currently have in memory and may be the
same as or less than, but never more than, {cmd:c(max_width_theory)}. In
the case of {help SpecialEdition:Stata/SE}, {cmd:c(max_width_theory)} is
affected by the {helpb maxvar:set maxvar} command.
{phang}
{cmd:c(max_matsize)} and {cmd:(min_matsize)} each return a numeric scalar
reporting the minimum and maximum values to which {help matsize} may be
set. If the version of Stata you are running does not allow you to set
{help matsize}, the two values will be equal. {cmd:c(matsize)}, documented
under "Memory settings" below, returns the current value of {help matsize}.
{phang}
{cmd:c(max_macrolen)} and {cmd:c(macrolen)} each return a numeric scalar
reporting the maximum length of macros. {cmd:c(max_macrolen)} and
{cmd:c(macrolen)} may not be equal in Stata/SE and will be equal otherwise.
For {help SpecialEdition:Stata/SE}, {cmd:macrolen} is set according to
{help maxvar}: the length is long enough to hold a macro referring to
every variable in the dataset.
{phang}
{cmd:c(max_cmdlen)} and {cmd:c(cmdlen)} each return a numeric scalar
reporting the maximum length of a Stata command. {cmd:c(max_cmdlen)} and
{cmd:c(cmdlen)} may not be equal in Stata/SE and will be equal otherwise.
For {help SpecialEdition:Stata/SE}, {cmd:cmdlen} is set according to
{help maxvar}: the length is long enough to hold a command referring to
every variable in the dataset.
{phang}
{cmd:c(namelen)} returns a numeric scalar equal to {ccl namelen}, which is the
current length of names in Stata.
{title:Numerical and string limits}
{phang}
{cmd:c(mindouble)}, {cmd:c(maxdouble)}, and {cmd:c(epsdouble)} each return a
numeric scalar. {cmd:c(mindouble)} is the largest negative number that can
be stored in the 8-byte {help double} storage type. {cmd:c(maxdouble)} is
the largest positive number that can be stored in a {help double}.
{cmd:c(epsdouble)} is the smallest nonzero, positive number (epsilon) that,
when added to 1 and stored as a {help double}, does not equal 1.
{phang}
{cmd:c(minfloat)}, {cmd:c(maxfloat)}, and {cmd:c(epsfloat)} each return a
numeric scalar that reports for the 4-byte {help float} storage type what
{cmd:c(mindouble)}, {cmd:c(maxdouble)}, and {cmd:c(epsdouble)} report for
{help double}.
{phang}
{cmd:c(minlong)} and {cmd:c(maxlong)} return scalars reporting the largest
negative and positive numbers that can be stored in the 4-byte, integer
{help long} storage type. Note that there is no {cmd:c(epslong)}, but if
there were, it would return 1.
{phang}
{cmd:c(minint)} and {cmd:c(maxint)} return scalars reporting the largest
negative and positive numbers that can be stored in the 2-byte, integer
{help int} storage type.
{phang}
{cmd:c(minbyte)} and {cmd:c(maxbyte)} return scalars reporting the largest
negative and positive numbers that can be stored in the 1-byte, integer
{help byte} storage type.
{phang}
{cmd:c(maxstrvarlen)} returns the longest {help data types:str}{it:#} string
storage type allowed, which is 244 in the case of
{help SpecialEdition:Stata/SE} and 80 otherwise. Do not confuse
{cmd:c(maxstrvarlen)} with {cmd:c(macrolen)}. {cmd:c(maxstrvarlen)}
corresponds to string variables stored in the data.
{title:Memory settings}
{phang}
{cmd:c(memory)} returns a numeric scalar reporting the amount of memory, in
bytes, allocated to Stata's data area, as set by {helpb memory:set memory}.
{phang}
{cmd:c(maxvar)} returns a numeric scalar reporting the maximum number of
variables currently allowed in a dataset, as set by
{helpb maxvar:set maxvar} if you are running
{help SpecialEdition:Stata/SE}. Otherwise, {cmd:c(maxvar)} is a constant.
{phang}
{cmd:c(matsize)} returns a numeric scalar reporting the current value of
{help matsize}, as set by {helpb matsize:set matsize}.
{title:Current dataset}
{phang}
{cmd:c(N)} returns a numeric scalar equal to {cmd:_N}, the number of
observations in the dataset in memory. In an expression, it makes no
difference whether you refer to {cmd:_N} or {cmd:c(N)}. However,
when used in expressions with the {cmd:by} prefix, {cmd:c(N)} does not
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -