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
Collapse by several variablesHi, I am working with panel data where I have 9 different regions and in each region there are a dif…
Help with Stochastic Frontier Analysis/Translog Cost Function in Stata 15, bc95 modelDear Stata users, I am using Stata 15 and I am quite new in using this software. I am working on a…
How to identify all cases with missing observationDear All How can I identify and list all cases with missing observation(denoted by .a) from a data …
Putexcel modify not workingDear all, I am writing to ask for a problem on the putexcel modify. I have an existing excel xls. f…
Sample size for 3 arm, 2 comparison sub-studyHi, I am looking to power a sub-study within a larger 2 arm randomised study. The outcome is a cont…
Subscribe to:
Post Comments (Atom)
0 Response to godir - for working in directories
Post a Comment