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
new table command cannot parse bracket within string variableIs this the correct place to report an apparent error in parsing? this is Stata/SE 17.0 for Windows …
Hte package - I cannot perform the command with a poisson distributionHello I'm using the hte package, more specifically the hte sm function, in order to obtain a multil…
Searching packages stored at SSC but returns nothingDear Stata users, I find an annoying problem recently. I search packages and Stata returns nothing,…
New version of ipwbreg on SSCThanks yet again to Kit Baum, a new version of the ipwbreg package is now available for download fro…
Problem with putexcel using corr_svy and foreach commandsHi everyone, I'm doing a task in which I have to do cross-tab and pairwise correlations for 3 dummy …
Subscribe to:
Post Comments (Atom)
0 Response to godir - for working in directories
Post a Comment