Don't know why this never took off - I'm sure I publicized it years ago. For anyone who's interested, put this program in your local ado directory. It's used after opening a data file. I keep projects in separate directories and at the start of session use File/Recent files to load the data, then type <godir> to make that the working directory. Simples! If anyone can improve the code, please do.
program godir
version 8
if strpos(reverse("$S_FN"),"/") {
local lastslash = length("$S_FN")-strpos(reverse("$S_FN"),"/")
}
else {
local lastslash = length("$S_FN")-strpos(reverse("$S_FN"),"")
}
local target = substr("$S_FN", 1,`lastslash')
if strpos("`target'", ".dta") local target= "`c(pwd)'"
cd "`target'"
end
Related Posts with godir - for working in directories
Unable to find detailed parameters for variablesHello everyone, I am using Stata /SE 17.0 working with the Pollock 2012 data set states.dta. I am ha…
Fixed Effects Regression - Binary Variable Can Only Equal 1 OnceDear all, I am working with a dataset looking at employee departures across a group of firms. The d…
Questions on the validity of a dynamic model of the Second-Order [using XTABOND2 command] My data is structured as follows Code: * Example generated by -dataex-. For more info, type help …
Reshape or transposeHi all, I have a question that I assume is incredibly simple that I just can't figure out: I have da…
Run regression separately for several periodsWhat are some reasons that can justify the necessity to run regressions after dividing the data into…
Subscribe to:
Post Comments (Atom)
0 Response to godir - for working in directories
Post a Comment