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

📄 while.hlp

📁 是一个经济学管理应用软件 很难找的 但是经济学学生又必须用到
💻 HLP
字号:
{smcl}
{* 03mar2005}{...}
{cmd:help while}
{hline}

{title:Title}

{p2colset 5 18 20 2}{...}
{p2col :{hi:[P] while} {hline 2}}Looping{p_end}
{p2colreset}{...}


{title:Syntax}

	{cmd:while} {it:exp} {cmd:{c -(}}
		{it:stata_commands}
	{cmd:{c )-}}

{pstd}
Braces must be specified with {cmd:while}, and

{phang2}
1.  the open brace must appear on the same line as the {cmd:while};

{phang2}
2.  nothing may follow the open brace except, of course, comments;
    the first command to be executed must appear on a new line;

{phang2}
3.  the close brace must appear on a line by itself.

{pstd}
In versions before Stata 8, putting the open brace, command, and close brace
on the same line as the {cmd:while} was allowed.  Old behavior is restored
under version control; see {helpb version}.


{title:Description}

{pstd}
{cmd:while} evaluates {it:exp} and, if it is true (nonzero), executes the
{it:stata_commands} enclosed in the braces. It then repeats the process until
{it:exp} evaluates to false (zero).  {cmd:while}s may be nested within
{cmd:while}s.  If the {it:exp} refers to any variables, their values in the
first observation are used unless explicit subscripts are specified; see
{hi:[U] 13.7 Explicit subscripting}.


{title:Example 1}

	{cmd:program define} {it:...}
		{cmd:syntax varlist} {it:...}
		{cmd:tokenize `varlist'}
		{cmd:while "`1'" != "" {c -(}}
			{it:...}
			{cmd:macro shift}
		{cmd:{c )-}}
		{it:...}
	{cmd:end}


{title:Example 2}

{pstd}
{cmd:while} may be used interactively.  Here we use it to generate
several uniform random variables.

	{cmd:. local i = 1}
	{cmd:. while `i' < 40 {c -(}}
	  {cmd:2. gen u`i' = uniform()}
	  {cmd:3. local i = `i' + 1}
	  {cmd:4. {c )-}}


{title:Also see}

{psee}
Manual:  {bf:[P] while}

{psee}
Online:  {helpb continue}, {helpb foreach},
{helpb forvalues}, {help ifcmd}
{p_end}

⌨️ 快捷键说明

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