Statalist The Stata Listserver


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

Re: st: forward vs backward slash in path names


From   Radu Ban <[email protected]>
To   [email protected]
Subject   Re: st: forward vs backward slash in path names
Date   Mon, 6 Feb 2006 09:24:26 -0500

I think the backslash "\" is also read by Stata as an escape
character, so if you use the backslash with macro names you have to
use a double backslash "\\" to get the separator behavior.

-radu

2006/2/6, Sascha O. Becker <[email protected]>:
> Dear statalisters,
>
> I always thought that the "/" (slashes) can be either forward or
> backward - Stata doesn't distinguish between them.
>
> However, in the following case, they produce very different results:
>
> foreach file in comp cons fami {;
>    capture use "$root/orig/`file'1976";
>    foreach num of numlist 1978(2)2004 {;
>       capture append using "$root/orig/`file'`num'";
>    };
> };
>
> works fine.
>
> However, the backslash version "$root\orig\`file'`num'"
> reads orig\`file'`num' as "orig`file'`num'" (a file which does not
> exist), i.e. seems to ignore the backslash altogether.
>
> Why is that?
>
> Best, Sascha
>
> --
>
> Dr. Sascha O. Becker
> Department of Economics
> Main Office, Economics Building
> University of California, San Diego
> 9500 Gilman Dr. Dept. 0508
> La Jolla, CA 92093-0508, USA
> *
> *   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