I'm translating some code between R and Stata with Stata 14 with Linux OS.
I'm pretty good at R and C programming, but Stata has me flummoxed. I would say the Stata user protection features have defeated me, actually.
All my scripts create directories. Stata for that is
That works once, but the second time this Stata program runs, it fails (and stops there!) because the directory already exists. I'd like to turn off the "stop there" feature in general and rewrite this to be smarter also. If the script would just keep running, I would be happy.
In Stata I can't find how to check if a directory exists. This seems like an obvious thing. In R, I'd write
In Stata help, I find a function "direxists", but if I try to use it, its a fail:
Obviously, I don't know how to use that one.
Generally, I'd like this script to keep running, even if Stata disagrees. But I've read the history in your forum and its a pretty unpopular suggestion
pj
I'm pretty good at R and C programming, but Stata has me flummoxed. I would say the Stata user protection features have defeated me, actually.
All my scripts create directories. Stata for that is
Code:
mkdir "../workingdata"
In Stata I can't find how to check if a directory exists. This seems like an obvious thing. In R, I'd write
Code:
wdir <- "../workingdata/" if (!file.exists("../workingdata/")) dir.create(wdir)
Code:
.direxists("../workingdata") command direxists is unrecognized
Generally, I'd like this script to keep running, even if Stata disagrees. But I've read the history in your forum and its a pretty unpopular suggestion

pj
Comment