Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Do compound double quotes fail, and if so, what is best to do?


From   "David Elliott" <dcelliott@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: Do compound double quotes fail, and if so, what is best to do?
Date   Thu, 14 Sep 2006 16:02:24 -0300

I have a situation where I am evaluating a line of log file text using:

       if  substr(`"`line'"',1,6)=="(file " {

I have found this can choke when `line' contains multiple mixed macro
quote characters giving a "too few quotes: error.

I am currently working around this with:

       if  substr(`"`macval(line)'"',1,6)=="(file " {

which processes `line' without any internal macro expansion,
effectively leaving it as is.  My question is, "is this the proper or
most efficient way to handle this, or are there alternatives?"  Do I
need to have compound double quotes in addition to using macval()?

Many thanks.

DCE
--
David Elliott
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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