Using Statements from Recorded Macros


Sometimes you can learn what macro statements to use by recording short macros. The simple task here is to deselect a plot with solid symbols – a single step macro recording task. With the graph displayed select Toolbox, Macros, Record New Macro and click with the mouse in the gray area outside the white page.

Click the Macro Recorder stop button and enter a name for the macro and click Ok. Then open the macro to see what statements have been recorded. To do this select Toolbox, Macros, Macros…, select the name you have chosen for the macro and select Edit. The following Select statement is displayed in the macro


Copy this line from the present macro and paste it as the last line in the Exponential Fit macro

Save the macro and close the macro Edit window. Run it from the Macros, Exponential Fit menu item to produce the final graph without the symbols selected.

Let’s try a somewhat more complicated example. We want to change the y axis to a common logarithmic scale and specify the lower and upper limits of the axis. Let´s see what the macro recorder gives us. With the graph in focus select Toolbox, Macros, Record New Macro. Double click on the y axis to bring up the Graph Properties dialog with Axes tab selected.

Click on the Scaling icon and change the Scale Type from Linear to Log (Common) and click Ok. Terminate the macro by clicking on the Stop Recording button and give the macro a name. For these “temporary” macros I use a name starting in “a”, in this case “alogaxis”, so that they are always located at the top of the list. Open the macro for editing (Toolbox, Macros, Macros…, select the macro name, Edit).

Some of these statements we want to use and others set default values that we are not interested in. The first two statements reflect the click on the y axis – we don’t need these. The remaining statements are used to set axis attributes ( SETAXISATTR). The SAA_TYPE statement looks like it is setting the axis type. To find out if this is true Highlight SAA_TYPE and press F1.

Click on “Use SAA TYPE constants”.

Our suspicions are confirmed since the type constant 2 is the common log scale. Lets comment out all statements except this one and run the macro (use an apostrophe prior to each line to comment it out). Double click on the y axis again and change the Scale Type back to Linear. Then click on the Start Macro button at the top left of the macro Edit window. It works – this single statement changes the axis scale to common logarithmic.

The axis limits may not be what you desire. The last two statements in the recorded macro look like they are used to specify the range. Highlight SAA_FROMVAL and press F1. The Help confirms that these statements are used to specify the axis limits. Uncomment these two statements and change the limit values as shown below

Test this by changing the y axis to linear and rerunning the macro. This works also. Now copy these three lines and paste them into the Exponential Fit macro after the curve fitting “Next I” for-loop statement and before the “bring graph to fron” code.

Save the macro, exit the macro Edit window and click Macros, Exponential Fit from the main menu to run the macro. The macro produces a logarithmic y axis.

Try SigmaPlot FREE for 30 Days!