📄 verinst.ado
字号:
*! version 1.1.4 09sep2002
program define verinst /* debug <opsys> <flavor> <error> */
local rel : display %9.1f _caller()
local rel = trim("`rel'")
version 6.0
if "`1'"=="debug" {
local sos "`2'"
local flavor "`3'"
local error "`4'"
}
else {
local sos "$S_OS"
local flavor "$S_FLAVOR"
}
version 7
if "$S_StataSE" == "" {
di _n in gr "You are running `flavor' Stata `rel' for `sos'."
}
else di _n in gr "You are running Stata/SE `rel' for `sos'."
version 6
chkadd
/* Test tempfile: check temporary files work */
if "`error'"=="tempfile" {
if "`sos'"=="MacOS" | "`sos'"=="MacOSX" {
local chk "~:Stata:NOTADIR:__00001.tmp"
}
else if "`sos'"=="DOS" | "`sos'"=="Windows" {
local chk "\NOTADIR\__000001.tmp"
}
else {
local chk "/NOTADIR/__000001.tmp"
}
}
else tempfile chk
quietly {
if _N==0 {
local phony "yes"
quietly {
drop _all
set obs 2
gen x=.
}
}
}
capture save "`chk'"
local rc = _rc
if "`phony'"!="" { drop _all }
if `rc' & ("`sos'"=="DOS" | "`sos'"=="Windows") {
#delimit ;
di in gr _n "PROBLEM:" _n
"The " in ye "TEMP" in gr " environment variable in your "
in ye "AUTOEXEC.BAT" in gr " file is either set" _n
"incorrectly or the directory pointed to by " in ye "TEMP"
in gr " does not exist." ;
local l = length("`chk'");
local dir = substr("`chk'",1,`l'-13);
di in gr _n "I just tried to save a file in " in ye "`dir'" ;
di in gr "I was not able to do so." ;
di in gr _n
"If what I tried does not look like a directory name, your "
in ye "AUTOEXEC.BAT" in gr " file" _n
"has an error. There is a line in it reading:" ;
di in wh _col(8) "SET TEMP=..." ;
di in gr
"The line needs to be removed or set to what could be a valid directory name,"
_n "such as:" ;
di in wh _col(8) "SET TEMP=C:\TEMP" ;
di _n in gr
"If what I tried does look like a directory name, then the directory does not"
_n "exist. In DOS, create the directory by typing:" ;
di in wh _col(8) "> MD `dir'" ;
di _n in gr "Exit Stata now (type " in wh "exit"
in gr ") and fix the problem." ;
#delimit cr
exit
}
if `rc' & "`sos'"=="Unix" {
#delimit ;
di in gr _n in gr "PROBLEM:" _n
"Either a directory does not exist, a directory has the permissions set" _n
"incorrectly, or your " in ye "TMPDIR" in gr
" environment variable is set incorrectly." ;
di in gr _n
"I just tried to create the file " in ye "`chk'" _n
in gr "I could not do so." ;
di in gr _n
"Exit Stata (type " in wh "exit" in gr ") and fix the problem." ;
#delimit cr
exit
}
if `rc' & ("`sos'"=="MacOS" | "`sos'"=="MacOSX") {
#delimit ;
di in gr _n "PROBLEM:" _n
"I'm baffled. An error that theoretically cannot happen on a Macintosh did."
_n "I tried to create the file " in ye "`chk'" ;
di in gr "I could not." ;
di in gr
"You will have to call Stata technical support (800-STATAPC)." ;
di in gr
"Exit Stata (type " in wh "exit" in gr ") and call." ;
#delimit cr
exit
}
if _rc {
#delimit ;
di in gr _n "PROBLEM:" ;
di in gr "I tried to create the file " in ye "`chk'" ;
di in gr "I could not." ;
di in gr _n
"Unfortunately, I do not have special instructions for " in ye "`sos'"
in gr "." ;
di in gr _n
"If you cannot determine what the problem is, you will have to call Stata" _n
"technical support (800-STATAPC)." ;
di in gr _n
"Exit Stata (type " in wh "exit" in gr "), fix the problem or call." ;
#delimit cr
exit
}
di _n in gr "Stata is correctly installed."
di in gr "You can type " in wh "exit" in gr " to exit Stata."
end
program define chkadd
if 2+2==4 {
exit
}
di in red "You are running the wrong flavor of Stata."
di in red "This computer does not have a coprocessor."
di in red "(Stata cannot even add 2+2 !)"
exit 198
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -