Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: assign several lines of syntax to local?

From   Maarten buis <>
Subject   Re: st: assign several lines of syntax to local?
Date   Thu, 12 Aug 2010 09:59:39 +0000 (GMT)

--- On Thu, 12/8/10, raoul reulen wrote:
> I have a large do-file in which a few lines of syntax come
> back several times. It is possible to assign a local to the
> lines of syntax so that I don't have to repeat it all the 
> time? <snip> So, essentially I would like to assign several
> lines of syntax to a local, is this possible? 

I am guessing that the problem is that you don't want to list
all the options on one line, because then that line would get
too long to be (easily) readable, and that a statement like

local a "foo  ///

doesn't work, as Stata considers the -///- as part of the string
and not as an indication that it needs to move to the next line. 

In that case you can temporarily change the delmiter to -;-, 
using the -#delimit- command, like in the example below:

*------------ begin example ------------
sysuse auto

#delimit ;
local opts vce(robust)
           beta ;
#delimit cr
reg price mpg, `opts'
*------------ end example --------------
(For more on examples I sent to the Statalist see: )

Hope this helps,

Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen


*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index