[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: some code that doesn't do what I expect
> I ran a do file that did something that I did not expect it do.
> Perhaps someone would like to try to reproduce this behaviour, or
> point out my mistake. I'm running Stata 8.2 on WinXP. Here's the log:
> . do "test01"
> . version 8
> . use "data\sndata.dta"
> . local foo "a_great_big_fish"
> . save "data\`foo'.dta"
> file data`foo'.dta saved
> end of do-file
> I expected `foo' to evaluate to "a_great_big_fish" in the save
> command. Using a double slash fixes the problem ( i.e. -save
> "data\\`foo'.dta"- ).
I believe this is a platform specific problem and is related to the fact that \ are used to
negate the normal interpretation of special characters in Stata as well as many other
languages (in this case the reference to the local macro).
The problem does not occur under linux systems as the division between directory
levels is represented by /
You can avoid this in Stata under windows by using / which are prefectly acceptable.
local foo "a_great_big_fish"
ARC Epidemiology Unit, University of Manchester
"If your result needs a statistician then you should design a better experiment" -
* For searches and help try: