Stata 15 help for delimit

[P] #delimit -- Change delimiter

Syntax

#delimit { cr | ; }

Description

The #delimit command resets the character that marks the end of a command. It can be used only in do-files and ado-files.

Remarks

#delimit (pronounced pound-delimit) is a Stata preprocessor command. #commands do not generate a return code, nor do they generate ordinary Stata errors. The only error message associated with #commands is "unrecognized #command".

Commands given from the console are always executed when you press the Enter, or Return, key. #delimit cannot be used interactively, so you cannot change Stata's interactive behavior.

Commands in a do-file, however, may be delimited with a carriage return or a semicolon. When a do-file begins, the delimiter is a carriage return. The command "#delimit ;" changes the delimiter to a semicolon. To restore the carriage return delimiter inside a file, use #delimit cr.

When a do-file begins execution, the delimiter is automatically set to carriage return, even if it was called from another do-file that set the delimiter to semicolon. Also, the current do-file need not worry about restoring the delimiter to what it was because Stata will do that automatically.

Examples

--- begin myfile1.do --------------------------- use mydata, clear #delimit ; regress lnwage educ complete age c.age#c.age exp c.exp#c.exp tenure c.tenure#c.tenure i.region female ; predict e, resid ; #delimit cr summarize e, detail --- end myfile1.do -----------------------------

Another way to do this without #delimit would be

--- begin myfile2.do --------------------------------- use mydata, clear regress lnwage educ complete age c.age#c.age /* */ exp c.exp#c.exp tenure c.tenure#c.tenure /* */ i.region female predict e, resid summarize e, detail --- end myfile2.do -----------------------------------

See [U] 16.1.3 Long lines in do-files for more information.

Technical note

Just because you have long lines does not mean that you must change the delimiter to semicolon. Stata does not care that the line is long. There are also other ways to indicate that more than one physical line is one logical line. One popular choice is ///:

regress lnwage educ complete age c.age#c.age /// exp c.exp#c.exp tenure c.tenure#c.tenure /// i.region female

See [P] comments.


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index