问题描述
我必须复制使用宏作为文件名的同事的 do 文件。问题是路径名包含括号,导致问题:
*setting directory
cd "D:/Dropbox (Center for Child Well-being and Development)/2020/Playground"
*setup
sysuse auto
save "/Dropbox (Center for Child Well-being and Development)/example",replace
*problem
global path "/Dropbox (Center for Child Well-being and Development)"
local file "/example.dta"
global data "$path`file'""
disp "$data"
use $data
我得到以下输出
. disp "$data"
/Dropbox (Center for Child Well-being and Development)/example.dta
. use $data
invalid '('
r(198);
我知道将引号内的宏调用为 use "$data"
可以完成这项工作,但由于它不是我的 do 文件,我想尽量避免更改每次使用宏的地方。
我试图用 \(
转义括号,并在构建全局时在我能想象的任何位置添加各种数量的引号。我还尝试添加转义引号 \"
,但两者都不起作用。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)