在Stata中拆分长文件路径
假设我的当前工作文件夹中有一个长文件路径(80多个字符):在Stata中拆分长文件路径,stata,Stata,假设我的当前工作文件夹中有一个长文件路径(80多个字符): use .\random_folders_name\project1\secret_data\survey_data\big_constructed_file.dta 我正在寻找一种方法,将其分成两行,以符合80个字符的行标准 我试过了 use .\random_folders_name\project1\secret_data\survey_data/// \big_constructed_file.dt
use .\random_folders_name\project1\secret_data\survey_data\big_constructed_file.dta
我正在寻找一种方法,将其分成两行,以符合80个字符的行标准
我试过了
use .\random_folders_name\project1\secret_data\survey_data///
\big_constructed_file.dta
及
没有成功
我宁愿不更改工作目录,因为这将使它有必要更改回来
+
可用于字符串串联,但只能在要计算的表达式中使用
这很有效
clear
set obs 1
gen whatever = "a" + "b"
local whatever = "a" + "b"
di "`whatever'"
这是有效的
clear
set obs 1
gen whatever = "a" + "b"
local whatever = "a" + "b"
di "`whatever'"
将字符串的一个或多个部分放在本地宏中是一种实现您想要的功能的方法,我建议您在一行中写入80个字符以内的内容
local dir ".\random_folders_name\project1\secret_data\survey_data\"
use "`dir'big_constructed_file.dta"
您可以这样做:
local name = ".\random_folders_name\project1\secret_data\survey_data" + ///
"\big_constructed_file.dta"
use "`name'"
这是我能采取的最接近你的方法并使其发挥作用的方法
在反斜杠上,请注意:我只使用cd
设置了一次“工作目录”。。。