0

I'm new to scripting Minitab 17 and have run into a snag that I can't find any documentation for, including an error message that brings up no hits on Google. All I want to do is generate macros that perform simple nonlinear regressions automatically, all of which execute just fine in the GUI or through Session Commmands. If I follow the directions on p. 10 of the Minitab Macros documentation and copy the commands I've successfully run from the Project Manager/History folder, copy them into a .MAC file and surround them with GMACRO and ENDMACRO commands, I end up with the code below:

GMACRO
NLinear;
  Response 'MyColumn1';
  Continuous 'MyOtherColumn2';
  Parameter "Theta1" 0.5;
  Parameter "Theta2" 0.2;
  Expectation Theta1 * ln (MyOtherColumn2 - Theta2 );
  NoDefault;
  TMethod;
  TStarting;
  TConstraints;
  TEquation;
  TParameters;
  TSummary;
  TPredictions.
ENDMACRO

The code between the MACRO statements runs OK from the GUI or as a Session Command. When I run the resulting macro file from the session prompt in Minitab, however, I invariably receive the following error: "Arguments not allowed in all global macro mode." I also receive syntax errors for every column that includes quote marks, even though that is standard session window syntax; I can eliminate these by substituting the column heading from my open worksheet, such as "C1", but can't get past the other error.

I'm obviously using some kind of incorrect syntax element(s) but can't pin them down - does anyone have any ideas? There are plenty of instructional materials on Minitab macros on the Web, but I haven't yet encountered any that deal with either this particular error or that delve much into how to execute ordinary Minitab tests of this kind. My goal is merely to write batch files that will do all my nonlinear regressions on off-hours etc. Thanks in advance.

SQLServerSteve
  • 332
  • 1
  • 11
  • 22

3 Answers3

1

Re-read pages 10-11 of http://support.minitab.com/en-us/minitab/18/macros-help/#page10.

The line after GMACRO should be the name of the macro, not a command.

Also, note that in a global macro the column names in 'single quotes' must exist in the active worksheet.

user20637
  • 664
  • 3
  • 11
  • Thank you - simply adding an arbitrary name in the second line of the code I posted did the trick. i figured I was missing something very simple, right before my nose - it would've taken me forever to recognize it though. Thaks. – SQLServerSteve Dec 20 '17 at 01:23
  • 1
    No problem. If you don't need the flow control constructs of a *.mac file you might find an "exec" file (*.mtb) easier http://support.minitab.com/en-us/minitab/18/macros-help/#page33. They are much more limited, but much easier to use for simple applications. – user20637 Dec 20 '17 at 17:40
  • Thanks for the heads-up, I may try them out. I saw mentions of these exec applications but was going to skip them 'cause they're apparently deprecated. If they're a better fit for my scenarios then I may give them a shot. – SQLServerSteve Dec 21 '17 at 15:40
  • 1
    Hmm. I've had no indication that execs themselves are deprecated and they're so useful and simple I'd be surprised, but I will check with Minitab support when I'm next in the office after Xmas. That link does say "If you have Execs that were written using previous releases of Minitab, you can continue to use them with no change, unless, of course, the Execs use deprecated commands", but that applies to any macros, not just execs. – user20637 Dec 21 '17 at 20:15
  • It's possible I saw the reference to them referred to in the Macros pdf to them being "an older form of Minitab macro" + the reference to "deprecated commands" and misconstrued them, but I think I saw mention of them at some Minitab user(s) webpage(s) here or there to them being deprecated, or at least obsolete/superseded. I wish I could provide a reference but just saw it in passing and didn't pay close attention, since it wasn't my primary concern. One way or another, you're probably right. – SQLServerSteve Dec 22 '17 at 16:14
0

the better way to learn Minitab macro is to do the job by the menu and then to go to the SESSION WINDOW and to look at how Minitab uses the function. Do your Nonlinear Regression with your data and then in the SESSION WINDOW (first icon of the Project Manager bar) you will see the code. After that it is more easy to do macro.

  • Thanks for the response, but I think you missed the point of my question. I can run the nonlinear regression via the menu and then retrieve the commands from the Session Window just fine; the problem is that when I put those commands into a macro, they result in the errors described in my post. There must be some kind of syntax error in the code I posted, but I can't pinpoint it. – SQLServerSteve Dec 14 '17 at 16:52
0

In this case I think about an issue I had sometimes: I don't know why but sometimes I had to switch the regional setting ('.' instead of ',' for numeric values) or to write ',' instead of ';' in the macro. You can try this.