Many Stata commands get easily quite long. Take, for example, a command to generate a figure – possibly the layout definitions are quite lengthy and difficult to read. Stretching commands over several lines makes it much easier to write and read, and less prone to errors.
There are different ways to stretch Stata commands over several lines. Note, however, that none of these can be used interactively! But if you select the text containing the long command with either of the three options and run it, it will work!
First part of the same command /// Second part of the same command /// Third part of the same command
First part of the command /* */ Second part of the same command /* */ Third part of the same command
Naturally, the line break is the limiter and closes each command line (and thereby the command). You can change that, however, to any other character with #delimit (often used is the semicolon: “;”)
#delimit ; First part of the command Second part of the same command Third part of the same command ; #delimit cr
The second #delimit cr sets back the delimiter to the natural line break delimiter
Author Jan Sauermann Posted on June 28, 2022 Categories Stata, Stata - Misc Tags commands, StataYou must be logged in to post a comment.