Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: RE: RE: RE: concatenating macros


From   "Wallace, John" <[email protected]>
To   <[email protected]>
Subject   st: RE: RE: RE: RE: concatenating macros
Date   Wed, 10 Nov 2004 14:20:41 -0800

Thanks Dan and Nick.  With Dan's suggestion the code runs perfectly.
Perhaps it's a V7 vs V8 difference, but the documentation is at [U]
21.3.9 in my books.  I should probably invest in a new set anyway.

-JW

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Nick Cox
Sent: Wednesday, November 10, 2004 1:04 PM
To: [email protected]
Subject: st: RE: RE: RE: concatenating macros

The issue is documented at [U] 21.3.10. 

Nick 
[email protected] 

Dan Menes
> 
> I find backslashes in path names cause no end of trouble in 
> Stata.  Whenever dealing with filenames, my first action is always
> 
> local pathvar: subinstr local pathvar "\\" "/", all
> 
> The problem is backslashes can have special meanings when 
> Stata tries to parse the line--they don't always get read as 
> literal backslashes.  In particular, I suspect in your 
> example the backslash is getting read as a modifier on the 
> quotation mark.
 
Wallace, John
 
> Sorry, the change in macro longname construction should have read:
> .local longname "`pathvar'`filename'"
> 
> Note the quotes around the concatenation.

... 
 
> The problem is that the final \ gets dropped from the path.
> 
> .di "`pathvar'"
> F:\CELS\
> 
> Oddly, the initial macro seems to store this correctly
> 
> Changing the longname macro construction to...
> .local longname `pathvar'`filename'
> .di "`longname'"
> F:\CELS35051403

*
*   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/

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index