The escape character delays the substitution of a macro. This will be
useful only to programmers, and is not considered good programming
style I believe (judging from the response it usually gets on this
list... just search the archives for "escape".).
Here is an example:
local test 5
di "This is the macro test: `test'"
di "This is the macro test (escaped): \`test'"
test has not been substituted in the last line. This will be useful
only in limited circumstances, e.g. when you want to "skip" a step in
your program.
Eva
2008/10/3 Caleb Southworth <[email protected]>:
>
> Eva, Thanks. That did it. What is the escape character for?
>
> I realized that I can use the mac/unix path names throughout, so
> perhaps that is better.
>
> On Fri, 3 Oct 2008, Eva Poen wrote:
>
> :Just use a forward slash in front of the local macro, and lose the
> :quotes in between:
> :
> :"c:\union_pop\orig/`file'"
> :
> :The backslash acts as escape character in Stata. You only need to
> :worry about it if it's directly followed by a macro.
> :
> :
> :Eva
> :
> :
> :
> :2008/10/3 Caleb Southworth <[email protected]>:
> :> I misunderstand something about the way locals are identified. The below
> :> program crashes when I try to -use- the filename in `r(files)'. If I take
> :> out the path name and change into that directory, then the program runs. How
> :> can I make this work with the path name? What is the proper way to use a
> :> local that is appended to another string, such as the path? Thanks!
> :>
> :> . fs c:\union_pop\orig\gifford*.dta
> :> gifford_2000.dta
> :>
> :> . foreach file in `r(files)'{
> :> 2. use "c:\union_pop\orig\""`file'", clear
> :> 3. ds _*
> :> 4. foreach var of varlist `r(varlist)'{
> :> 5. bysort id: assert `var'==. if `var'[_n+1]!=.
> :> 6. }
> :> 7. }
> :> invalid '"gifford_2000.dta'
> :> r(198);
> :>
> :> end of do-file
> :>
> :> r(198);
> :>
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/