[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: RE: local macros & saving in directory
Daniel Muller started a thread with
> I coded:
> version 7
> local var "somevar"
> ... code in terms of `var'
> out `var's using "d:\stata\export\`var's.asc", runtogether replace
> However, the file is saved in dir <d:\stata> under the name
> <export`var's.asc>, not as I expected in dir <d:\stata\export> as
> Where is my mistake? Why does Stata strip off the slash before `var'?
As pointed out by Zhiqiang Wang and Antoine Terracol,
this behaviour arises because in Stata the meaning of \ as an escape
overrides its meaning as a separator in Windows file
specifications whenever \ precedes a left quote `.
It is not a bug.
The more general principle is that Stata is designed,
as far as possible, to work the same across the platforms
on which is supported, currently Windows, various flavours
of Unix (including Linux) and Macintosh, an admirable principle
but one not always possible to satisfy down to every last detail.
In this case, \ clearly has a special meaning within Windows,
but there is a clash in the circumstance identified by Daniel,
as is documented at [U] 21.3.9.
A good fix for this problem is to get into a general habit
of using / as a separator within Stata. This may seem
strange to Windows users, but Stata will happily translate
whenever it interacts with Windows on your behalf.
* For searches and help try: