Bookmark and Share

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


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

Re: st: semicolon in local, under delimit ;


From   Nick Winter <[email protected]>
To   [email protected]
Subject   Re: st: semicolon in local, under delimit ;
Date   Thu, 06 Feb 2014 19:46:43 -0500

I suppose the work-around would be to split your lines with comments, rather than by changing the delimiter:

mycommand that has very long ///
    syntax that goes over     ///
    many lines


On 2/6/2014 4:32 PM, David Kantor wrote:
Hello,
I find that if I have...

#delimit ;

local m1  "abc;def";
disp "`m1'";

-- that works as expected, but...

local m2  `"abc;def"';
disp "`m2'";

chokes on the -local- command. It appears to stop at the first semicolon, and renders an "invalid syntax" error.
Apparently, the embedded semicolon signals the end of the command.

Notice that this happens with compound quotes, but not with simple quotes.

Does anyone have experience with this? -- a solution?
I need to use compound quotes because the actual situation has a macro with components that have embedded spaces -- so that -foreach- will pick up segments of the macro having embedded spaces. Thus, for example,
local m3 `""first item" "second item""'
--is constructed so that -foreach- yields two pieces:
first item
second item
--rather than four pieces:
first
item
second
item

And the real-life application is too big to put on one line, so I use #delimit ;.
It worked fine until I added an item having an embedded semicolon.

I use Stata 10. (I plan to upgrade soon.)

Thanks
--David

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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