⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 specialedition.hlp

📁 是一个经济学管理应用软件 很难找的 但是经济学学生又必须用到
💻 HLP
字号:
{smcl}
{* 16mar2005}{...}
{cmd:help specialedition}{right:{browse "http://www.stata.com"}}
{hline}

{title:Stata/SE:  The Special Edition version of Stata}

{pstd}
Stata is available in three flavors:

{p 8 12 4}
    1.  Small Stata {hline 2} A smaller, "student" version of Stata

{p 8 12 4}
    2.  Intercooled Stata {hline 2} The "standard" version of Stata

{p 8 12 4}
    3.  Stata/SE {hline 2} Stata for large datasets

{pstd}
This help file concerns Stata/SE.  To determine which flavor of Stata you
are running, type

	    {cmd:. about}

{pstd}
For information on upgrading to Stata/SE, point your browser to
{browse "http://www.stata.com"}.


{title:Contents}

	1.  Product description
	2.  Starting Stata/SE
	3.  Setting Stata/SE's limits
	    3.1  Advice on setting {cmd:maxvar}
	    3.2  Advice on setting {cmd:matsize}
	    3.3  Advice on setting {cmd:memory}
	4.  Implications of the {cmd:str244} maximum
	5.  Sharing .dta datasets with non-SE users
	6.  A feature to note
	7.  Advice to programmers
	    7.1  {cmd:c(SE)}
	    7.2  Avoid {cmd:macro shift} in program loops


{title:1.  Product description}

{pstd}
For those familiar with Stata, a table will say it all:

{center:{c TLC}{hline 11}{c TT}{hline 27}{c TT}{hline 27}{c TRC}}
{center:{c |}{space 11}{c |}  {hline 2} Intercooled Stata {hline 2}  {c |}  {hline 7} Stata/SE {hline 6}  {c |}}
{center:{c |} Parameter {c |}  Default     min     max  {c |}  Default     min     max  {c |}}
{center:{c LT}{hline 11}{c +}{hline 27}{c +}{hline 27}{c RT}}
{center:{c |} {cmd:maxvar}    {c |}    2,047   2,047   2,047  {c |}    5,000   2,047  32,766  {c |}}
{center:{c |} {cmd:matsize}   {c |}      200      10     800  {c |}      400      10  11,000  {c |}}
{center:{c |} {cmd:memory}    {c |}       1M    500K     ...  {c |}      10M    500K     ...  {c |}}
{center:{c |}{space 11}{c |}{space 27}{c |}{space 27}{c |}}
{center:{c |} {cmd:str}{it:#}      {c |}        .       1      80  {c |}        .       1     244  {c |}}
{center:{c BLC}{hline 11}{c BT}{hline 27}{c BT}{hline 27}{c BRC}}

{pstd}
Stata/SE

{p 8 12 4}
1.  Allows datasets with more variables {hline 2} up to 32,766 variables.

{p 8 12 4}
2.  Allows datasets to contain longer string variables{hline 2}variables up
    to 244 characters long.

{p 8 12 4}
3.  Allows larger matrices{hline 2}matrices up to 11,000 x 11,000.  (An
    implication of this is that Stata/SE can fit models with more
    independent variables and can fit certain panel-data models with
    longer time series within panel.)

{pstd}
To exploit the features of Stata/SE, you need to set the limits {cmd:maxvar},
{cmd:matsize}, and {cmd:memory}.  This is described in
"{hi:3. Setting Stata/SE's limits}" below.


{title:2.  Starting Stata/SE}

{pstd}
You start Stata/SE very much as you start Intercooled Stata:

{p 8 12 4}
    Windows:{break}
	Select {bf:Start > Programs > Stata > Stata/SE {ccl stata_version}}

{p 8 12 4}
    Macintosh:{break}
        Double-click the file {hi:Stata.do} from the {hi:Stata Data} folder, or
        double-click the {hi:StataSE} icon from the {hi:Stata} folder.

{p 8 12 4}
    Unix:{break}
	At the Unix command prompt, type {cmd:xstata-se} to invoke the
	GUI version of Stata/SE or type {cmd:stata-se} to invoke the
	console version.


{title:3.  Setting Stata/SE's limits}

{pstd}
The three limits for Stata/SE are

{p 8 16 4}
    1.  {cmd:maxvar}{break}
	    The maximum number of variables allowed in a dataset.
	    This limit is initially set to 5,000; you can increase it
	    up to 32,766.

{p 8 16 4}
    2.  {cmd:matsize}{break}
	    The maximum size of matrices or, said differently, the
	    maximum number of independent variables allowed in the models that
	    you fit.  This limit is initially set to 400, and you can
	    increase it up to 11,000.

{p 8 16 4}
    3.  {cmd:memory}{break}
	    The amount of memory Stata requests from the operating system
	    to store your data.  This limit is initially set to
	    10 megabytes.  You may set it to as large a number as your
	    operating system will allow.

{pstd}
You set the limits using the

	    {cmd:set maxvar}  {it:#}          [{cmd:,} {cmdab:perm:anently}]
	    {cmd:set matsize} {it:#}          [{cmd:,} {cmdab:perm:anently}]
	    {cmd:set memory}  {it:#}[{cmd:b}|{cmd:k}|{cmd:m}|{cmd:g}] [{cmd:,} {cmdab:perm:anently}]

{pstd}
commands.  For instance, you might type

	    {cmd:. set maxvar  5000}
	    {cmd:. set matsize 900}
	    {cmd:. set memory  50m}

{pstd}
The order in which you set the limits does not matter.  If you specify the
{cmd:permanently} option when you set a limit, in addition to making the change
right now, Stata/SE will remember the new limit and use it in the future when
you invoke Stata/SE:

	    {cmd:. set maxvar  5000, permanently}
	    {cmd:. set matsize 900, permanently}
	    {cmd:. set memory  50m, permanently}

{pstd}
You can reset the current or permanent limits whenever and as often as you
wish.


{title:3.1  Advice on setting maxvar}

	    {cmd:set maxvar}  {it:#} [{cmd:,} {cmdab:perm:anently}]{right:2,048 <= {it:#} <= 32,766    }

{pstd}
Why is there a limit on {cmd:maxvar}?  Why not just set {cmd:maxvar} to
32,766 and be done with it?  Because simply allowing room for variables, even
if they do not exist, causes Stata to consume memory, and if you will only be
using datasets with a lot fewer variables, you will be wasting memory.

{pstd}
The formula for the amount of memory consumed by {cmd:set maxvar} is
approximately

{center:megs = .3147*({cmd:maxvar}/1000) + .002  }

{pstd}
For instance, if you set {cmd:maxvar} to 20,000, the memory used would be
approximately

{center:megs = .3147*20 + .002 = 6.296 megs}

{pstd}
and if you left it at the default, the memory use would be roughly

{center:megs = .3147*5  + .002 = 1.575 megs}

{pstd}
Thus how big you set {cmd:maxvar} does not dramatically affect memory usage.
Still, at {cmd:maxvar}=32,000, memory use is 10.072M.

{p 8 8 4}
    {bf:Recommendation}:  Think about datasets with the most variables that
    you typically use.  Set {cmd:maxvar} to a few hundred or even a 1,000
    above that.  (Note that the memory cost of an extra 1,000 variables is
    only .315 megs.)

{p 8 8 4}
    {bf:Remember}, you can always reset {cmd:maxvar} temporarily by typing
    {cmd:set maxvar} {it:#}.

{p 8 8 4}
    {it:Technical note:}
    The formula above is only approximate, and the formula given is the
    formula appropriate for 32-bit computers.  When you set {cmd:maxvar},
    Stata/SE will give you a memory report showing the exact amount of
    memory used:

	{hline 68}
	{cmd}. set maxvar 10000
	{txt}
	{title:Current memory allocation}

{col 25}current{col 65}memory usage
{col 9}settable{col 27}value{col 37}description{col 65}(1M = 1024k)
{col 9}{hline 68}
{col 9}set maxvar{col 26}{res: 10000}{col 37}max. variables allowed           3.149M
{col 9}set memory          {res:10M}{col 37}max. data space                 10.000M
{col 9}set matsize{col 25}{res:    400}{col 37}max. RHS vars in models          1.254M
{col 65}{hline 11}
{col 59}          14.403M{txt}
	{hline 68}


{title:3.2  Advice on setting matsize}

	    {cmd:set matsize} {it:#} [{cmd:,} {cmdab:perm:anently}]{right:10 <= {it:#} <= 11,000    }

{pstd}
Although {cmd:matsize} can theoretically be set up to 11,000, on all but the
largest 64-bit computers you will be unable to do that, and even if you
succeeded, Stata/SE would probably run out of memory subsequently.
The value of
{cmd:matsize} has a dramatic effect on memory usage, the formula being

{center:megs = (8*{cmd:matsize}^2 + 88*{cmd:matsize})/(1024^2)}

{pstd}
This formula is valid across all computers, 32 bit and 64 bit.  For
instance, the above formula states

{center:{c TLC}{hline 11}{c TT}{hline 14}{c TRC}}
{center:{c |}  {cmd:matsize}  {c |}  memory use  {c |}}
{center:{c LT}{hline 11}{c +}{hline 14}{c RT}}
{center:{c |}      400  {c |}      1.254M  {c |}}
{center:{c |}      800  {c |}      4.950M  {c |}}
{center:{c |}    1,600  {c |}     19.666M  {c |}}
{center:{c |}    3,200  {c |}     78.394M  {c |}}
{center:{c |}    6,400  {c |}    313.037M  {c |}}
{center:{c |}   11,000  {c |}    924.080M  {c |}}
{center:{c BLC}{hline 11}{c BT}{hline 14}{c BRC}}

{pstd}
The formula, in fact, understates the amount of memory certain
Stata commands use and understates what you will certainly use
yourself if you use matrices directly.  The formula gives the amount of memory
required for one matrix and 11 vectors.  If two matrices are required, the
numbers above are nearly doubled.  When you {cmd:set matsize}, if you specify
too large a value, Stata will refuse, but remember that just because Stata
does not complain, you still may run into problems later.
Stata might be running some statistical command and then complain,
"op. sys. refuses to provide memory"; r(909).

{pstd}
For {cmd:matsize}==11,000, nearly 1 gigabyte of memory is required, and
doubling that would require nearly 2 gigabytes of memory.  On most 32-bit
computers, 2 gigabytes is the maximum amount of memory that the operating
system will allocate to a single task, so nearly nothing would be left for all
the rest of Stata.

{pstd}
Why, then, is {cmd:matsize} allowed to be set so large?  Because on 64-bit
computers, such large amounts cause no difficulty.

{pstd}
For "reasonable" values of matsize (say up to 3,200), memory consumption
is not too great.   Choose a reasonable value given the kinds of models
you fit, and remember that you can always reset the value.


{title:3.3  Advice on setting memory}

	    {cmd:set memory}  {it:#}[{cmd:b}|{cmd:k}|{cmd:m}|{cmd:g}] [{cmd:,} {cmdab:perm:anently}]{right:{it:#} >= 500k    }

{pin2}
	({cmd:b}, {cmd:k}, {cmd:m}, and {cmd:g} may be typed in uppercase.)

{pstd}
The advice for setting memory is the same as for Intercooled Stata:  set
enough so that your datasets fit easily, and do not set so much that you exceed
physical memory present on your computer, except in emergencies.

{pstd}
You may set memory in bytes (b), kilobytes (k), megabytes (m), or gigabytes
(g), but the number specified must be an integer, so if you want to set 1.5g,
you set 1500m.  Actually, 1.5g is 1536m because the formulas for a kilobyte,
megabyte, and gigabyte are

		1024 bytes     = 1 kilobyte
		1024 kilobytes = 1 megabyte
		1024 megabytes = 1 gigabyte

{pstd}
This detail does not matter, but this is the rule that Stata uses when
presenting numbers, so do not be surprised when 2000k is not displayed
as 2M, or 2M is displayed as 2048k.

{pstd}
If you have a 32-bit computer, the maximum amount of memory you can
set may surprise you.  Many people think that 32-bit computers can allow up to
4 gigabytes of memory, and that, in a sense, is true.  Some 32-bit computers
will even allow you to install 4 gigabytes of physical memory.  Nevertheless,
most modern operating systems will allocate a maximum of one-half the
theoretical maximum to individual tasks, meaning that most operating
systems will allow Stata only 2 gigabytes of memory (even if they have 4
gigabytes of memory)!

{pstd}
The same one-half rule applies to 64-bit computers, but half the theoretical
limit is still 536,870,912 gigabytes, so no one much cares.

{pstd}
This one-half limit is imposed by the operating system, not by Stata, and
the operating-system developers have good technical reasons for imposing
the rule.


{title:4.  Implications of the str244 maximum}

{pstd}
The maximum length of string variables in a Stata/SE dataset is 244 characters,
as opposed to 80 for the other flavors of Stata.  You may create
variables that are {cmd:str81}, {cmd:str82}, ..., {cmd:str244}.

{pstd}
The maximum length of the text of value labels is 32,000, meaning that if you
use {helpb encode} to convert a string variable into an integer, labeled
variable, you are assured that the new variable is logically equivalent to the
original one.

{pstd}
The maximum length of strings in expressions in Stata/SE is
244, as opposed to 80 for the other flavors of Stata.

{pstd}
The maximum length of dataset labels and variable labels is 80, just as it is
in Intercooled Stata and Small Stata.


{title:5.  Sharing .dta dataset with non-SE users}

{pstd}
If you share datasets with Intercooled Stata (non-SE) users, you must
remember that they cannot have string variables longer than {cmd:str80}.  Make
sure that you have no such variables in the datasets.  The easy way to do that
is

	    {cmd:. save mydata, intercooled}

{pstd}
The {cmd:intercooled} option instructs Stata to verify that there are no
variables longer than {cmd:str80}.


{title:6.  A feature to note}

{pstd}
The command

	    {cmd:. query memory}

{pstd}
will display the memory report that {cmd:set maxvar}, {cmd:set matsize},
and {cmd:set memory} display.  This way you do not have to change a value
to find out what you are using and how much memory is consumed by the
limits that you set.

{pstd}
{cmd:query memory}, and {cmd:set} {cmd:maxvar}, {cmd:set} {cmd:matsize}, and
{cmd:set} {cmd:memory} set the return values

{p 12 25 4}{cmd:r(maxvar)}{space 4}current value of {cmd:set maxvar}{p_end}
{p 12 25 4}{cmd:r(m_maxvar)}{space 2}corresponding memory usage associated
	with {cmd:maxvar}

{p 12 25 4}{cmd:r(matsize)}{space 3}current value of {cmd:set matsize}{p_end}
{p 12 25 4}{cmd:r(m_matsize)} corresponding memory usage associated with
	{cmd:matsize}

{p 12 25 4}{cmd:r(memory)}{space 4}current value of {cmd:set memory}{p_end}
{p 12 25 4}{cmd:r(m_memory)}{space 2}corresponding memory usage associated
	with {cmd:memory}


{title:7.  Advice to programmers}

{title:7.1  c(SE)}

{pstd}
The constant {cmd:c(SE)} contains 1 if the currently running
Stata is Stata/SE and contains 0 otherwise.


{title:7.2  Avoid macro shift in program loops}

{pstd}
{helpb macro:macro shift} has terrible performance implications when used with
variable lists containing 20,000 or more variables.  We recommend avoiding the
use of {cmd:macro shift} in loops and instead 
using either {helpb foreach} or "double
indirection".  Double indirection means referring to {cmd:``i''} when
{cmd:`i'} contains a number 1, 2, ....


{title:Also see}

{psee}
Online:  
{helpb about},
{help data types},
{help limits},
{helpb matsize},
{helpb memory},
{helpb set}
{p_end}

⌨️ 快捷键说明

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