| |
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: quotes in macros
I need to create a global macro containing several filenames, each of
which contains a space. This is ok for a short list of short names:
glo list `""file one" "file two" "file three""'
but what I really want is
glo list `""rather long filename one" "rather long filename two" ///
"ridiculously long filename three which takes a whole line" ///
(etc etc) ///
"'
This generates a syntax error, I suppose because quoted strings can't
be split over lines.
Note that in a do-file, the following DOES work:
glo list first_filename_with_no_spaces ///
"after the first, quotes strings with spaces are ok" ///
"file three" "file four"
The problem comes only if the first name needs quoting. So a clumsy
workaround is:
glo list null "file one" ///
etc
foreach file of any $list {
if "`file'"=="null" continue
...
}
But who wants that?
kd
(using Stata 9.2, Win-XP)
Dr Keith B.G. Dear
Senior Fellow in Biostatistics
National Centre for Epidemiology and Population Health
Australian National University
Canberra, ACT 0200, Australia
Tel: 02 612 54865, Fax: 02 612 50740
http://nceph.anu.edu.au/Staff_Students/staff_pages/dear.php
CRICOS provider #00120C
*
* 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/