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

📄 mf_st_tempname.hlp

📁 是一个经济学管理应用软件 很难找的 但是经济学学生又必须用到
💻 HLP
字号:
{smcl}
{* 29mar2005}{...}
{cmd:help mata st_tempname()}
{hline}
{* index stata temporary names}{...}
{* index stata temporary filenames}{...}
{* index st_tempname()}{...}
{* index st_tempfilename()}{...}

{title:Title}

{p 4 4 2}
{bf:[M-5] st_tempname() -- Temporary Stata names}


{title:Syntax}

{p 8 12 2}
{it:string scalar}{bind:   }
{cmd:st_tempname()}

{p 8 12 2}
{it:string rowvector}
{cmd:st_tempname(}{it:real scalar n}{cmd:)}


{p 8 12 2}
{it:string scalar}{bind:   }
{cmd:st_tempfilename()}

{p 8 12 2}
{it:string rowvector}
{cmd:st_tempfilename(}{it:real scalar n}{cmd:)}


{title:Description}

{p 4 4 2}
{cmd:st_tempname()} returns a Stata temporary name, the same as would be 
returned by Stata's {cmd:tempvar} and {cmd:tempname} commands; see 
{bf:{help macro:[P] macro}}.

{p 4 4 2}
{cmd:st_tempname(}{it:n}{cmd:)} returns {it:n} temporary Stata names, {it:n}>=0.

{p 4 4 2}
{cmd:st_tempfilename()} returns a Stata temporary filename, the same as would be 
returned by Stata's {cmd:tempfile} command; see 
{bf:{help macro:[P] macro}}.

{p 4 4 2}
{cmd:st_tempname(}{it:n}{cmd:)} returns {it:n} temporary filenames, {it:n}>=0.


{title:Remarks}

{p 4 4 2}
Remarks are presented under the headings

	{it:Creating temporary objects}
	{it:When temporary objects will be eliminated}


{title:Creating temporary objects}

{p 4 4 2}
{cmd:st_tempname()}s can be used to name Stata's variables, matrices, and
scalars.  Although in Stata a distinction is drawn between {cmd:tempvar}s and
{cmd:tempname}s, there is in fact no real distinction, and so
{cmd:st_tempname()} handles both in Mata.  For instance, one can create a
temporary variable by coding

	{cmd:idx = st_addvar("double", st_tempname())}

{p 4 4 2}
See {bf:{help mf_st_addvar:[M-5] st_addvar()}}.

{p 4 4 2}
One creates a temporary file by coding

	{cmd:fh = fopen(st_tempfilename(), "w")}

{p 4 4 2}
See {bf:{help mf_fopen:[M-5] fopen()}}.


{title:When temporary objects will be eliminated}

{p 4 4 2}
Temporary objects do not vanish when the Mata function ends, nor when Mata
itself ends.  They are removed when the ado-file (or do-file) calling Mata
terminates.

{p 4 4 2}
Forget Mata for a minute.  Stata eliminates temporary variables and files when
the program that created them ends.
That same rule applies to Mata:  Stata eliminates them, not Mata, and that
means that the ado-file or do-file that called Mata will eliminate them when
that ado-file or do-file ends.  Temporary variables and files are not
eliminated by Mata when the Mata function ends.  Thus Mata
functions can create temporary objects for use by their ado-file
callers, should that prove useful.


{title:Conformability}

    {cmd:st_tempname()}, {cmd:st_tempfilename()}:
	   {it:result}:  1 {it:x} 1

    {cmd:st_tempname(}{it:n}{cmd:)}, {cmd:st_tempfilename(}{it:n}{cmd:)}:
		{it:n}:  1 {it:x} 1
	   {it:result}:  1 {it:x n}


{title:Diagnostics}

{p 4 4 2}
{cmd:st_tempname(}{it:n}{cmd:)} 
and 
{cmd:st_tempfilename(}{it:n}{cmd:)} 
abort with error if {it:n}<0 and return
J(1,0,"") if {it:n}==0.


{title:Source code}

{p 4 4 2}
Functions are built-in.


{title:Also see}

{p 4 13 2}
Manual:  {hi:[M-5] st_tempname()}

{p 4 13 2}
Online:  help for 
{bf:{help mf_st_addvar:[M-5] st_addvar()}};
{bf:{help m4_stata:[M-4] stata}}
{p_end}

⌨️ 快捷键说明

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