What exactly is recorded in Master Macros?

Datafile selections
The recording of the Master Macro begins when you select Start Recording Log of Analyses (Master Macro) from the Tools - Macro menu. If you select an input datafile after you start the recording, then the selection of that file will become part of the Master Macro. For example, suppose you opened a file and then started a Multiple Regression analysis; the recorded macro would include the following lines:

...

Dim S1 As Spreadsheet

Set S1 = Spreadsheets.Open ("c:\datasets\OilAnalysis.sta")

S1.Visible = True

Dim newanalysis2 As Analysis

Set newanalysis2 = Analysis (scMultipleRegression,S1) ...

The input datafiles selection was explicitly recorded, and the Multiple Regression was initialized using the datafile that was explicitly opened for this analysis. Hence, if you run this Master Macro, the analysis will be performed on the same datafile, i.e., it will be loaded from the disk prior to the Multiple Regression analysis.

Now suppose you started the recording of the Master Macro after you had already selected and opened an input datafile. The same analysis might be recorded like this.

...

Dim S1 As Spreadsheet

Set S1 = ActiveSpreadsheet

Dim newanalysis2 As Analysis

Set newanalysis2 = Analysis (scMultipleRegression,S1)

...

Now the recording started by defining as the input datafile the currently active input spreadsheet. If you run this Master Macro, the Multiple Regression analysis would be performed on the currently active input datafile, i.e., possibly a different datafile than that used while recording the Master Macro.

Data editing operations
Certain data editing operations on an input spreadsheet (datafile) are recorded as part of Master Macros. As a general rule, most editing operations that are accomplished via selections on respective dialogs (e.g., the Sort Options dialog) are recorded; operations that are performed via simple keyboard actions (e.g., deleting a data value by pressing the Delete key on your keyboard) are usually not recorded. Also keep in mind that the Master Macro recording only starts when the recording is explicitly requested; so any editing operations that are performed prior to the start of the recording of course will not be reflected in the Master Macro. Here is a list of data editing operations that are recorded into Master Macros:

Most operations available on the Data menu are recorded.

  • Sorting
  • Creating subsets of cases or variables
  • Changes in the variable specifications
  • Data transformations via formulas entered into the specifications dialogs of the respective variables
  • Adding, moving, copying, and deleting variables
  • Adding, moving, copying, and deleting cases
  • Ranking of data
  • Recoding operations
  • Automatic replacement of missing data operations
  • Shifting of data
  • Standardizing data
  • Date operations

Recordable operations performed outside the Data menu, include:

  • Creation of new datafiles (spreadsheets)
  • Opening datafiles
  • All Output Manager options
  • Filling data ranges with random values (note that this operation is recorded even though it is accomplished without going through dialogs, but by selecting it from the Edit menu)
  • Entering case selection conditions on a global and local (one analysis) level
  • Entering case weight variables on a global and local (one analysis) level
Note: recording of certain operations as part of the Master Macro logs might lead to creating ambiguous and context-dependent solutions, so they are excluded from the list of recordable tasks. This includes such operations as:
  • Editing values in the spreadsheets
  • Selections of cells
  • Clipboard based copy, paste, and delete operations (note that this does not include the copy, move, and delete cases and variables operations listed above)
  • Generally, anything not on the list of recordable data management operations (see above).

Keep these issues in mind when recording a Master Macro with data editing operations that are necessary before subsequent analyses are performed.

Recording consecutive and simultaneous analyses
To reiterate, Master Macro recordings will reproduce the exact sequence of analyses and output choices (of results spreadsheets or graphs) made during the analysis. This facility provides great flexibility and even allows you to "string together" analyses so that the first one computes certain results, while the second one analyzes those results further. For example, you could first perform a Multiple Regression analysis on a particular datafile, then use the option Save on the results dialog of the Multiple Regression analysis to create a stand-alone input spreadsheet of predicted and residual values from the analysis, and then compute Basic Statistics on the numbers in that spreadsheet. The Master Macro recording of that sequence of analyses would look something like this:

...

Dim S1 As Spreadsheet

Set S1 = Spreadsheets.Open ("c:\Statistica\OilAnalysis.sta")

S1.Visible = True

Dim newanalysis1 As Analysis

Set newanalysis1 = Analysis (scMultipleRegression,S1)

...

Dim newanalysis2 As Analysis

Set newanalysis2 = Analysis (scBasicStatistics,ActiveDataSet)

With newanalysis2.Dialog

 .Statistics = scBasDescriptives

End With

...

Note how consecutive analyses (objects) are enumerated as newanalysis1 and newanalysis2. The first one (Multiple Regression) is initialized with an explicit input datafile; the second one is initialized with the currently active dataset. When recording complex sequences of analyses like these where results of one analysis serve as the input for subsequent analyses, extra care must be taken to review and, if necessary, edit the final macro before running it to ensure that the intended sequence of ActiveDataSets are chosen by the respective analyses.

Case selection conditions, case weights
Like Analysis Macros, when case selection conditions or case weights are specified during an analysis, those actions are properly recorded in the Master Macro. However, in addition, when you specify case selection conditions and case weights globally for the datafile (i.e., outside any specific analysis), those actions are recorded as well.
Handling output: Sending results to workbooks, reports, etc
Like Analysis Macros, when case output options are changed during an analysis, those selections are recorded in the macro. In addition, if global output defaults are changed via the Tools - Options menu (on the Output Manager tab of the Options dialog), then those choices are recorded into the Master Macro as well. Therefore, if you started a Master Macro, then set the global Output Manager option to direct all results spreadsheets and graphs to separate workbooks (for each analysis) as well as to reports, then those selections will be recorded in the Master Macro and reproduced when you execute that macro.
Master Macro recording and Analysis Macro recording
The two major modes of macro recording - Master Macros and Analysis Macros, which are always being recorded in the "background" - can be used simultaneously. In other words, you can make Analysis Macros while recording a Master Macro. However, note that the action of creating the Analysis Macro is not itself recorded in the Master Macro.