using runmlwin in batch mode on Unix

Welcome to the forum for runmlwin users. Feel free to post your question about runmlwin here. The Centre for Multilevel Modelling take no responsibility for the accuracy of these posts, we are unable to monitor them closely. Do go ahead and post your question and thank you in advance if you find the time to post any answers!

Go to runmlwin: Running MLwiN from within Stata >> http://www.bristol.ac.uk/cmm/software/runmlwin/
becciaa1992
Posts: 21
Joined: Thu Oct 17, 2019 12:21 am

using runmlwin in batch mode on Unix

Post by becciaa1992 »

Hi all,

I am having such a hard time configuring runmlwin to run in batch mode on Unix. I am able to successfully run runmlwin on my personal computer, however, when I try to run it on Unix, I keep getting an error that suggests that I am not specifying the global statements correctly (I am getting the invalid name error). However, I definitely have the path name correctly ... does anyone have experience with this and know if this is done differently on Unix? Thanks!
ChrisCharlton
Posts: 1351
Joined: Mon Oct 19, 2009 10:34 am

Re: using runmlwin in batch mode on Unix

Post by ChrisCharlton »

Could you please provide further information on how you have set up the software, as well as provide the exact output and error message that you are receiving?
becciaa1992
Posts: 21
Joined: Thu Oct 17, 2019 12:21 am

Re: using runmlwin in batch mode on Unix

Post by becciaa1992 »

Yes of course!

To install runmlwin, I followed the instructions on this page: https://www.bristol.ac.uk/cmm/media/run ... ocation.do

thus using the following code:

Code: Select all

global sysdir_plus = c(sysdir_plus)
sysdir set PLUS "~/STATA"
ssc install runmlwin
sysdir set PLUS "$sysdir_plus"
adopath + "~/STATA"
This seems to have worked, as I no longer get an error signifying that the runmlwin command is not recognized, and it also placed a series of folders (titled "m", "r", "s", and "u") in the folder that I specified ("STATA"). I believe that running this code is also what placed the folder titled "ado" within my home directory on the server that I'm working on.

I have put the file called "mlnscript" in the ado > personal folder (which also contains files entitled libmln.so, mlnscipt.1, runmlwin.ado, and LICENSE), thus using the following commands to specify the global macro:

Code: Select all

global MLwiNScript_path "~/ado/personal/mlnscript"
global MLwiN_path "~/ado/personal/mlnscript"
I then run the following code (via batch mode):

Code: Select all

* Load the data
use "~/STATA/distress.dta", clear   
sort group idcode
gen cons = 1
gen denominator = 1

* Fit model using PQL2
runmlwin distress_cats cons , ///
  level2(group: cons) ///
  level1(idcode:) ///
  discrete(distribution(binomial) link(logit) denominator(denominator) pql2) ///
  rigls maxiterations(100) ///
  nopause
And get the following error:

Code: Select all

... invalid name
Any advice would be great, thank you so much in advance!! :)
ChrisCharlton
Posts: 1351
Joined: Mon Oct 19, 2009 10:34 am

Re: using runmlwin in batch mode on Unix

Post by ChrisCharlton »

Could you confirm that you are running the most recent version of runmlwin? This should correspond to the version at https://bitbucket.org/cmm_stata/runmlwi ... nmlwin.ado. The plugin for determining the MLwiN version does not exist on Linux/Mac, so it should be getting to the check on line 116. You can determine exactly where the error is occurring by running the command:

Code: Select all

set trace on
prior to your runmlwin call. This should then display the code that is being run when the error occurred. If the cause isn't obvious could you post this log and I will see if I can tell what is going on?
becciaa1992
Posts: 21
Joined: Thu Oct 17, 2019 12:21 am

Re: using runmlwin in batch mode on Unix

Post by becciaa1992 »

Hi Chris,

Thank you so much for your help, this is so appreciated. Here is the log output from using the "set trace on" command:

set trace on

.
. * Fit model using PQL2
. runmlwin distress_cats cons , ///
> level2(group: cons) ///
> level1(idcode:) ///
> discrete(distribution(binomial) link(logit) denominator(denominator) pql2)
> ///
> rigls maxiterations(100) ///
> nopause
---------------------------------------------------------- begin runmlwin ---
- if c(stata_version) >= 15 local user user
- if _caller() >= 12 version 12.0, `user'
= if _caller() >= 12 version 12.0, user
- if _caller() <= 9 version 9.0, `user'
= if _caller() <= 9 version 9.0, user
- display " "

- if replay() {
if ("`e(cmd)'" ~= "runmlwin") error 301
syntax [, Level(cilevel) CFORMAT(string) PFORMAT(string) SFORMAT(string) no
> HEADer noGRoup noCONTrast noFETable noRETable SD CORrelations OR IRr RRr MOde
> MEdian Zratio *]
runmlwin_display, level(`level') cformat(`cformat') pformat(`pformat') sfor
> mat(`sformat') `header' `group' `contrast' `fetable' `retable' `sd' `correlat
> ions' `or' `irr' `rrr' `mode' `median' `zratio'
makecns, displaycns
}
- else {
- syntax anything [if] [in], [Level(cilevel) CFORMAT(string) PFORMAT(string)
> SFORMAT(string) noHEADer noGRoup noCONTrast noFETable noRETable SD CORrelatio
> ns OR IRr RRr MOde MEdian Zratio *]
- timer clear 99
- timer on 99
- Estimates `0'
= Estimates distress_cats cons , level2(group: cons) level1(idcode:) di
> screte(distribution(binomial) link(logit) denominator(denominator) pql2) ri
> gls maxiterations(100) nopause
---------------------------------------------- begin runmlwin.Estimates ---
- if _caller() >= 12 version 12.0
- if _caller() <= 9 version 9.0
- local runmlwin_cmdline `0'
= local runmlwin_cmdline distress_cats cons , level2(group: cons) level
> 1(idcode:) discrete(distribution(binomial) link(logit) denominator(denomina
> tor) pql2) rigls maxiterations(100) nopause
- local maxlevels 1
- gettoken comma tmpstr : 0, parse(",") bind
- while strpos("`tmpstr'", "level") != 0 {
= while strpos(", level2(group: cons) level1(idcode:) discrete(distri
> bution(binomial) link(logit) denominator(denominator) pql2) rigls maxiterat
> ions(100) nopause", "level") != 0 {
- local tmpstr = substr("`tmpstr'", strpos("`tmpstr'", "level") + 5, .)
= local tmpstr = substr(", level2(group: cons) level1(idcode:) discre
> te(distribution(binomial) link(logit) denominator(denominator) pql2) rigls
> maxiterations(100) nopause", strpos(", level2(group: cons) level1(idcod
> e:) discrete(distribution(binomial) link(logit) denominator(denominator) pq
> l2) rigls maxiterations(100) nopause", "level") + 5, .)
- local lev = substr("`tmpstr'", 1, strpos("`tmpstr'", "(") - 1)
= local lev = substr("2(group: cons) level1(idcode:) discrete(distribut
> ion(binomial) link(logit) denominator(denominator) pql2) rigls maxiteration
> s(100) nopause", 1, strpos("2(group: cons) level1(idcode:) discrete(dis
> tribution(binomial) link(logit) denominator(denominator) pql2) rigls maxite
> rations(100) nopause", "(") - 1)
- if `=real("`lev'")' != . {
= if 2 != . {
- if `lev' > `maxlevels' {
= if 2 > 1 {
- local maxlevels `lev'
= local maxlevels 2
- }
- }
- }
- while strpos("`tmpstr'", "level") != 0 {
= while strpos("2(group: cons) level1(idcode:) discrete(distribution(bi
> nomial) link(logit) denominator(denominator) pql2) rigls maxiterations(100)
> nopause", "level") != 0 {
- local tmpstr = substr("`tmpstr'", strpos("`tmpstr'", "level") + 5, .)
= local tmpstr = substr("2(group: cons) level1(idcode:) discrete(distri
> bution(binomial) link(logit) denominator(denominator) pql2) rigls maxiterat
> ions(100) nopause", strpos("2(group: cons) level1(idcode:) discrete(dis
> tribution(binomial) link(logit) denominator(denominator) pql2) rigls maxite
> rations(100) nopause", "level") + 5, .)
- local lev = substr("`tmpstr'", 1, strpos("`tmpstr'", "(") - 1)
= local lev = substr("1(idcode:) discrete(distribution(binomial) link(log
> it) denominator(denominator) pql2) rigls maxiterations(100) nopause", 1,
> strpos("1(idcode:) discrete(distribution(binomial) link(logit) denominator(
> denominator) pql2) rigls maxiterations(100) nopause", "(") - 1)
- if `=real("`lev'")' != . {
= if 1 != . {
- if `lev' > `maxlevels' {
= if 1 > 2 {
local maxlevels `lev'
}
- }
- }
- while strpos("`tmpstr'", "level") != 0 {
= while strpos("1(idcode:) discrete(distribution(binomial) link(logit) de
> nominator(denominator) pql2) rigls maxiterations(100) nopause", "level")
> != 0 {
local tmpstr = substr("`tmpstr'", strpos("`tmpstr'", "level") + 5, .)
local lev = substr("`tmpstr'", 1, strpos("`tmpstr'", "(") - 1)
if `=real("`lev'")' != . {
if `lev' > `maxlevels' {
local maxlevels `lev'
}
}
}
- if ("`verbose'"~="") display as text "Highest level: `maxlevels'"
= if (""~="") display as text "Highest level: 2"
- local levargs
- forvalues l = 2/`maxlevels' {
= forvalues l = 2/2 {
- local levargs LEVEL`l'(string) `levargs'
= local levargs LEVEL2(string)
- }
- syntax anything(name=eqlist id="equations" equalok) [if] [in], [ `levargs
> ' ] LEVEL1(string) [ Weights(string) Constraints(numlist >0 integer) IGLS RIG
> LS TOLerance(numlist >0 integer min=1 max=1) MAXIterations(numlist >0 integer
> min=1 max=1) FPSandwich RPSandwich INITSPrevious INITSB(namelist min=1 max=1
> ) INITSV(namelist min=1 max=1) INITSModel(namelist min=1 max=1) DISCRETE(stri
> ng) MCMC(string) SEED(numlist integer min=1 max=1) SIMulate(namelist min=1 ma
> x=1) MLWINPATH(string) MLWINSCRIPTPATH(string) VIEWMacro SAVEMacro(string) SA
> VEWorksheet(string) SAVEStata(string) USEWorksheet(string) Level(cilevel) CFO
> RMAT(string) PFORMAT(string) SFORMAT(string) OR IRr RRr SD CORrelations MOde
> MEdian Zratio noHEADer noGRoup noCONTrast noFETable noRETable noDrop FORCESor
> t FORCERecast noMLWIN noPause noVERSIONCHECK BATCh noSORT PLUGIN Verbose VIEW
> FULLMacro SAVEFULLMacro(string) SAVEEQuation(string) MLWINSETTINGS(string) ]
= syntax anything(name=eqlist id="equations" equalok) [if] [in], [ LEVEL2(s
> tring) ] LEVEL1(string) [ Weights(string) Constraints(numlist >0 integer) IGL
> S RIGLS TOLerance(numlist >0 integer min=1 max=1) MAXIterations(numlist >0 in
> teger min=1 max=1) FPSandwich RPSandwich INITSPrevious INITSB(namelist min=1
> max=1) INITSV(namelist min=1 max=1) INITSModel(namelist min=1 max=1) DISCRETE
> (string) MCMC(string) SEED(numlist integer min=1 max=1) SIMulate(namelist min
> =1 max=1) MLWINPATH(string) MLWINSCRIPTPATH(string) VIEWMacro SAVEMacro(strin
> g) SAVEWorksheet(string) SAVEStata(string) USEWorksheet(string) Level(cilevel
> ) CFORMAT(string) PFORMAT(string) SFORMAT(string) OR IRr RRr SD CORrelations
> MOde MEdian Zratio noHEADer noGRoup noCONTrast noFETable noRETable noDrop FOR
> CESort FORCERecast noMLWIN noPause noVERSIONCHECK BATCh noSORT PLUGIN Verbose
> VIEWFULLMacro SAVEFULLMacro(string) SAVEEQuation(string) MLWINSETTINGS(strin
> g) ]
- local doublevar 1
- if c(mode) == "batch" local batch = c(mode)
- if "`mlwinpath'" == "" & "`mlwinscriptpath'" ~= "" & "`batch'" ~= "" loca
> l mlwinpath `mlwinscriptpath'
= if "" == "" & "" ~= "" & "batch" ~= "" local mlwinpath
- if "`mlwinpath'" == "" & "$MLwiNScript_path" ~= "" & "`batch'" ~= "" loca
> l mlwinpath $MLwiNScript_path
= if "" == "" & "/udd/nkabe/ado/personal/mlnscript" ~= "" & "batch" ~= "" l
> ocal mlwinpath /udd/nkabe/ado/personal/mlnscript
- if "`mlwinpath'" == "" & "$MLwiN_path" ~= "" local mlwinpath $MLwiN_path
= if "/udd/nkabe/ado/personal/mlnscript" == "" & "/udd/nkabe/ado/personal/m
> lnscript" ~= "" local mlwinpath /udd/nkabe/ado/personal/mlnscript
- if "`mlwin'"~="nomlwin" & "`mlwinpath'" ~= "" {
= if ""~="nomlwin" & "/udd/nkabe/ado/personal/mlnscript" ~= "" {
- capture confirm file "`mlwinpath'"
= capture confirm file "/udd/nkabe/ado/personal/mlnscript"
- if _rc == 601 {
display as error "`mlwinpath' does not exist." _n
exit 198
}
- if "`versioncheck'" ~= "noversioncheck" {
= if "" ~= "noversioncheck" {
- quietly capture runmlwin_verinfo `mlwinpath'
= quietly capture runmlwin_verinfo /udd/nkabe/ado/personal/mlnscript
---------------------------------------------- begin runmlwin_verinfo ---
- version 9.0
- syntax [anything] [, *]
- tempname ver1
- tempname ver2
- tempname ver3
- tempname ver4
- scalar `ver1' = .
= scalar __000001 = .
- scalar `ver2' = .
= scalar __000002 = .
- scalar `ver3' = .
= scalar __000003 = .
- scalar `ver4' = .
= scalar __000004 = .
- capture plugin call runmlwin_getversion, `"`anything'"' "`ver1'" "`ver2
> '" "`ver3'" "`ver4'"
= capture plugin call runmlwin_getversion, `"/udd/nkabe/ado/personal/mlns
> cript"' "__000001" "__000002" "__000003" "__000004"
- if c(rc) == 199 {
- display as error "Warning: getversion plugin could not be loaded"
- }
- display as text "Version: " `ver1' as text "." `ver2' as text "." `ver3
> ' as text "." `ver4'
= display as text "Version: " __000001 as text "." __000002 as text "." _
> _000003 as text "." __000004
- return clear
- return scalar ver1 = `ver1'
= return scalar ver1 = __000001
- return scalar ver2 = `ver2'
= return scalar ver2 = __000002
- return scalar ver3 = `ver3'
= return scalar ver3 = __000003
- return scalar ver4 = `ver4'
= return scalar ver4 = __000004
------------------------------------------------ end runmlwin_verinfo ---
- if _rc == 198 {
display as error "`mlwinpath' is not a valid version of MLwiN"
exit 198
}
- local majorver `r(ver1)'
= local majorver .
- local minorver : display %02.0f `r(ver2)'
= local minorver : display %02.0f .
- local versionok = 1
- local versionold = 0
- if (`majorver' < 2) | (`majorver' == 2 & `minorver' < 36) local versionok
> = 0
= if (. < 2) | (. == 2 & . < 36) local versionok = 0
- if (`majorver' < 3) | (`majorver' == 3 & `minorver' < 03) local versionol
> d = 1
= if (. < 3) | (. == 3 & . < 03) local versionold = 1
- if `versionok' == 0 {
= if 1 == 0 {
display as error "runmlwin assumes MLwiN version 2.36 or higher. You can
> download the latest version of MLwiN at:" _n "https://www.bristol.ac.uk/cmm/s
> oftware/mlwin/download/upgrades.html." _n "If you want to ignore this warning
> and attempt to continue anyway you can use the noversioncheck option"
exit 198
}
- if `versionold' == 1 display as error "WARNING: Your version of MLwiN is
> out of date. You can download the latest version of MLwiN at:" _n "https://ww
> w.bristol.ac.uk/cmm/software/mlwin/download/upgrades.html"
= if 0 == 1 display as error "WARNING: Your version of MLwiN is out of date
> . You can download the latest version of MLwiN at:" _n "https://www.bristol.a
> c.uk/cmm/software/mlwin/download/upgrades.html"
- }
- local mlwinversion `majorver'.`minorver'
= local mlwinversion .. .
- if "`mlwinversion'" ~= "..." {
= if ".. ." ~= "..." {
- if `mlwinversion' < 3 {
= if .. . < 3 {
.. invalid name
local doublevar 0
}
}
------------------------------------------------ end runmlwin.Estimates ---
if "`e(mcmcnofit)'" == "1" {
exit
}
timer off 99
quietly timer list
ereturn scalar time = r(t99)
timer clear 99
runmlwin_display, level(`level') cformat(`cformat') pformat(`pformat') sfor
> mat(`sformat') `header' `group' `contrast' `fetable' `retable' `sd' `correlat
> ions' `or' `irr' `rrr' `mode' `median' `zratio'
}
------------------------------------------------------------ end runmlwin ---
r(198);

end of do-file
r(198);
ChrisCharlton
Posts: 1351
Joined: Mon Oct 19, 2009 10:34 am

Re: using runmlwin in batch mode on Unix

Post by ChrisCharlton »

Thanks for this. It appears that there is an extra space in the version number, which is preventing it from being matched. Could you try replacing:

Code: Select all

local minorver : display %02.0f `r(ver2)'
with:

Code: Select all

local minorver : `r(ver2)'
and seeing if it is able to get any further?

If this works I will look into putting a more general fix into newer versions of runmlwin.
becciaa1992
Posts: 21
Joined: Thu Oct 17, 2019 12:21 am

Re: using runmlwin in batch mode on Unix

Post by becciaa1992 »

Hi Chris,

Just to clarify, do you mean copying and pasting that log output from having trace on into the do-file (with the replacement you noted) and re-running? ... apologies if this is a silly question!!

When I do that, I seem to just get the same log file back (i.e., I'm not seeing any model output). But perhaps I'm doing something wrong.
ChrisCharlton
Posts: 1351
Joined: Mon Oct 19, 2009 10:34 am

Re: using runmlwin in batch mode on Unix

Post by ChrisCharlton »

Sorry for not being clearer. I meant open the file runmlwin.ado, search for local minorver : display %02.0f `r(ver2)' and replace it with local minorver : `r(ver2)' (i.e. remove the display %02.0 prefix).
becciaa1992
Posts: 21
Joined: Thu Oct 17, 2019 12:21 am

Re: using runmlwin in batch mode on Unix

Post by becciaa1992 »

ah, got it, thank you for the clarification! So now I get an error that simply says " not allowed", with log file output:

* Fit model using PQL2
. runmlwin distress_cats cons , ///
> level2(group: cons) ///
> level1(idcode:) ///
> discrete(distribution(binomial) link(logit) denominator(denominator) pql2)
> ///
> rigls maxiterations(100) ///
> nopause
---------------------------------------------------------- begin runmlwin ---
- if c(stata_version) >= 15 local user user
- if _caller() >= 12 version 12.0, `user'
= if _caller() >= 12 version 12.0, user
- if _caller() <= 9 version 9.0, `user'
= if _caller() <= 9 version 9.0, user
- display " "

- if replay() {
if ("`e(cmd)'" ~= "runmlwin") error 301
syntax [, Level(cilevel) CFORMAT(string) PFORMAT(string) SFORMAT(string) no
> HEADer noGRoup noCONTrast noFETable noRETable SD CORrelations OR IRr RRr MOde
> MEdian Zratio *]
runmlwin_display, level(`level') cformat(`cformat') pformat(`pformat') sfor
> mat(`sformat') `header' `group' `contrast' `fetable' `retable' `sd' `correlat
> ions' `or' `irr' `rrr' `mode' `median' `zratio'
makecns, displaycns
}
- else {
- syntax anything [if] [in], [Level(cilevel) CFORMAT(string) PFORMAT(string)
> SFORMAT(string) noHEADer noGRoup noCONTrast noFETable noRETable SD CORrelatio
> ns OR IRr RRr MOde MEdian Zratio *]
- timer clear 99
- timer on 99
- Estimates `0'
= Estimates distress_cats cons , level2(group: cons) level1(idcode:) di
> screte(distribution(binomial) link(logit) denominator(denominator) pql2) ri
> gls maxiterations(100) nopause
---------------------------------------------- begin runmlwin.Estimates ---
- if _caller() >= 12 version 12.0
- if _caller() <= 9 version 9.0
- local runmlwin_cmdline `0'
= local runmlwin_cmdline distress_cats cons , level2(group: cons) level
> 1(idcode:) discrete(distribution(binomial) link(logit) denominator(denomina
> tor) pql2) rigls maxiterations(100) nopause
- local maxlevels 1
- gettoken comma tmpstr : 0, parse(",") bind
- while strpos("`tmpstr'", "level") != 0 {
= while strpos(", level2(group: cons) level1(idcode:) discrete(distri
> bution(binomial) link(logit) denominator(denominator) pql2) rigls maxiterat
> ions(100) nopause", "level") != 0 {
- local tmpstr = substr("`tmpstr'", strpos("`tmpstr'", "level") + 5, .)
= local tmpstr = substr(", level2(group: cons) level1(idcode:) discre
> te(distribution(binomial) link(logit) denominator(denominator) pql2) rigls
> maxiterations(100) nopause", strpos(", level2(group: cons) level1(idcod
> e:) discrete(distribution(binomial) link(logit) denominator(denominator) pq
> l2) rigls maxiterations(100) nopause", "level") + 5, .)
- local lev = substr("`tmpstr'", 1, strpos("`tmpstr'", "(") - 1)
= local lev = substr("2(group: cons) level1(idcode:) discrete(distribut
> ion(binomial) link(logit) denominator(denominator) pql2) rigls maxiteration
> s(100) nopause", 1, strpos("2(group: cons) level1(idcode:) discrete(dis
> tribution(binomial) link(logit) denominator(denominator) pql2) rigls maxite
> rations(100) nopause", "(") - 1)
- if `=real("`lev'")' != . {
= if 2 != . {
- if `lev' > `maxlevels' {
= if 2 > 1 {
- local maxlevels `lev'
= local maxlevels 2
- }
- }
- }
- while strpos("`tmpstr'", "level") != 0 {
= while strpos("2(group: cons) level1(idcode:) discrete(distribution(bi
> nomial) link(logit) denominator(denominator) pql2) rigls maxiterations(100)
> nopause", "level") != 0 {
- local tmpstr = substr("`tmpstr'", strpos("`tmpstr'", "level") + 5, .)
= local tmpstr = substr("2(group: cons) level1(idcode:) discrete(distri
> bution(binomial) link(logit) denominator(denominator) pql2) rigls maxiterat
> ions(100) nopause", strpos("2(group: cons) level1(idcode:) discrete(dis
> tribution(binomial) link(logit) denominator(denominator) pql2) rigls maxite
> rations(100) nopause", "level") + 5, .)
- local lev = substr("`tmpstr'", 1, strpos("`tmpstr'", "(") - 1)
= local lev = substr("1(idcode:) discrete(distribution(binomial) link(log
> it) denominator(denominator) pql2) rigls maxiterations(100) nopause", 1,
> strpos("1(idcode:) discrete(distribution(binomial) link(logit) denominator(
> denominator) pql2) rigls maxiterations(100) nopause", "(") - 1)
- if `=real("`lev'")' != . {
= if 1 != . {
- if `lev' > `maxlevels' {
= if 1 > 2 {
local maxlevels `lev'
}
- }
- }
- while strpos("`tmpstr'", "level") != 0 {
= while strpos("1(idcode:) discrete(distribution(binomial) link(logit) de
> nominator(denominator) pql2) rigls maxiterations(100) nopause", "level")
> != 0 {
local tmpstr = substr("`tmpstr'", strpos("`tmpstr'", "level") + 5, .)
local lev = substr("`tmpstr'", 1, strpos("`tmpstr'", "(") - 1)
if `=real("`lev'")' != . {
if `lev' > `maxlevels' {
local maxlevels `lev'
}
}
}
- if ("`verbose'"~="") display as text "Highest level: `maxlevels'"
= if (""~="") display as text "Highest level: 2"
- local levargs
- forvalues l = 2/`maxlevels' {
= forvalues l = 2/2 {
- local levargs LEVEL`l'(string) `levargs'
= local levargs LEVEL2(string)
- }
- syntax anything(name=eqlist id="equations" equalok) [if] [in], [ `levargs
> ' ] LEVEL1(string) [ Weights(string) Constraints(numlist >0 integer) IGLS RIG
> LS TOLerance(numlist >0 integer min=1 max=1) MAXIterations(numlist >0 integer
> min=1 max=1) FPSandwich RPSandwich INITSPrevious INITSB(namelist min=1 max=1
> ) INITSV(namelist min=1 max=1) INITSModel(namelist min=1 max=1) DISCRETE(stri
> ng) MCMC(string) SEED(numlist integer min=1 max=1) SIMulate(namelist min=1 ma
> x=1) MLWINPATH(string) MLWINSCRIPTPATH(string) VIEWMacro SAVEMacro(string) SA
> VEWorksheet(string) SAVEStata(string) USEWorksheet(string) Level(cilevel) CFO
> RMAT(string) PFORMAT(string) SFORMAT(string) OR IRr RRr SD CORrelations MOde
> MEdian Zratio noHEADer noGRoup noCONTrast noFETable noRETable noDrop FORCESor
> t FORCERecast noMLWIN noPause noVERSIONCHECK BATCh noSORT PLUGIN Verbose VIEW
> FULLMacro SAVEFULLMacro(string) SAVEEQuation(string) MLWINSETTINGS(string) ]
= syntax anything(name=eqlist id="equations" equalok) [if] [in], [ LEVEL2(s
> tring) ] LEVEL1(string) [ Weights(string) Constraints(numlist >0 integer) IGL
> S RIGLS TOLerance(numlist >0 integer min=1 max=1) MAXIterations(numlist >0 in
> teger min=1 max=1) FPSandwich RPSandwich INITSPrevious INITSB(namelist min=1
> max=1) INITSV(namelist min=1 max=1) INITSModel(namelist min=1 max=1) DISCRETE
> (string) MCMC(string) SEED(numlist integer min=1 max=1) SIMulate(namelist min
> =1 max=1) MLWINPATH(string) MLWINSCRIPTPATH(string) VIEWMacro SAVEMacro(strin
> g) SAVEWorksheet(string) SAVEStata(string) USEWorksheet(string) Level(cilevel
> ) CFORMAT(string) PFORMAT(string) SFORMAT(string) OR IRr RRr SD CORrelations
> MOde MEdian Zratio noHEADer noGRoup noCONTrast noFETable noRETable noDrop FOR
> CESort FORCERecast noMLWIN noPause noVERSIONCHECK BATCh noSORT PLUGIN Verbose
> VIEWFULLMacro SAVEFULLMacro(string) SAVEEQuation(string) MLWINSETTINGS(strin
> g) ]
- local doublevar 1
- if c(mode) == "batch" local batch = c(mode)
- if "`mlwinpath'" == "" & "`mlwinscriptpath'" ~= "" & "`batch'" ~= "" loca
> l mlwinpath `mlwinscriptpath'
= if "" == "" & "" ~= "" & "batch" ~= "" local mlwinpath
- if "`mlwinpath'" == "" & "$MLwiNScript_path" ~= "" & "`batch'" ~= "" loca
> l mlwinpath $MLwiNScript_path
= if "" == "" & "/udd/nkabe/ado/personal/mlnscript" ~= "" & "batch" ~= "" l
> ocal mlwinpath /udd/nkabe/ado/personal/mlnscript
- if "`mlwinpath'" == "" & "$MLwiN_path" ~= "" local mlwinpath $MLwiN_path
= if "/udd/nkabe/ado/personal/mlnscript" == "" & "/udd/nkabe/ado/personal/m
> lnscript" ~= "" local mlwinpath /udd/nkabe/ado/personal/mlnscript
- if "`mlwin'"~="nomlwin" & "`mlwinpath'" ~= "" {
= if ""~="nomlwin" & "/udd/nkabe/ado/personal/mlnscript" ~= "" {
- capture confirm file "`mlwinpath'"
= capture confirm file "/udd/nkabe/ado/personal/mlnscript"
- if _rc == 601 {
display as error "`mlwinpath' does not exist." _n
exit 198
}
- if "`versioncheck'" ~= "noversioncheck" {
= if "" ~= "noversioncheck" {
- quietly capture runmlwin_verinfo `mlwinpath'
= quietly capture runmlwin_verinfo /udd/nkabe/ado/personal/mlnscript
---------------------------------------------- begin runmlwin_verinfo ---
- version 9.0
- syntax [anything] [, *]
- tempname ver1
- tempname ver2
- tempname ver3
- tempname ver4
- scalar `ver1' = .
= scalar __000001 = .
- scalar `ver2' = .
= scalar __000002 = .
- scalar `ver3' = .
= scalar __000003 = .
- scalar `ver4' = .
= scalar __000004 = .
- capture plugin call runmlwin_getversion, `"`anything'"' "`ver1'" "`ver2
> '" "`ver3'" "`ver4'"
= capture plugin call runmlwin_getversion, `"/udd/nkabe/ado/personal/mlns
> cript"' "__000001" "__000002" "__000003" "__000004"
- if c(rc) == 199 {
- display as error "Warning: getversion plugin could not be loaded"
- }
- display as text "Version: " `ver1' as text "." `ver2' as text "." `ver3
> ' as text "." `ver4'
= display as text "Version: " __000001 as text "." __000002 as text "." _
> _000003 as text "." __000004
- return clear
- return scalar ver1 = `ver1'
= return scalar ver1 = __000001
- return scalar ver2 = `ver2'
= return scalar ver2 = __000002
- return scalar ver3 = `ver3'
= return scalar ver3 = __000003
- return scalar ver4 = `ver4'
= return scalar ver4 = __000004
------------------------------------------------ end runmlwin_verinfo ---
- if _rc == 198 {
display as error "`mlwinpath' is not a valid version of MLwiN"
exit 198
}
- local majorver `r(ver1)'
= local majorver .
- local minorver : `r(ver2)'
= local minorver : .
. not allowed
local versionok = 1
local versionold = 0
if (`majorver' < 2) | (`majorver' == 2 & `minorver' < 36) local versionok
> = 0
if (`majorver' < 3) | (`majorver' == 3 & `minorver' < 03) local versionol
> d = 1
if `versionok' == 0 {
display as error "runmlwin assumes MLwiN version 2.36 or higher. You can
> download the latest version of MLwiN at:" _n "https://www.bristol.ac.uk/cmm/s
> oftware/mlwin/download/upgrades.html." _n "If you want to ignore this warning
> and attempt to continue anyway you can use the noversioncheck option"
exit 198
}
if `versionold' == 1 display as error "WARNING: Your version of MLwiN is
> out of date. You can download the latest version of MLwiN at:" _n "https://ww
> w.bristol.ac.uk/cmm/software/mlwin/download/upgrades.html"
}
local mlwinversion `majorver'.`minorver'
if "`mlwinversion'" ~= "..." {
if `mlwinversion' < 3 {
local doublevar 0
}
}
}
------------------------------------------------ end runmlwin.Estimates ---
if "`e(mcmcnofit)'" == "1" {
exit
}
timer off 99
quietly timer list
ereturn scalar time = r(t99)
timer clear 99
runmlwin_display, level(`level') cformat(`cformat') pformat(`pformat') sfor
> mat(`sformat') `header' `group' `contrast' `fetable' `retable' `sd' `correlat
> ions' `or' `irr' `rrr' `mode' `median' `zratio'
}
------------------------------------------------------------ end runmlwin ---
r(101);

end of do-file
r(101);
ChrisCharlton
Posts: 1351
Joined: Mon Oct 19, 2009 10:34 am

Re: using runmlwin in batch mode on Unix

Post by ChrisCharlton »

Sorry, I missed removing a bit. It should read: local minorver `r(ver2)' without the colon (as for the r(ver1) line a little higher up).
Post Reply