What exactly is recorded in Analysis Macros?

Analysis Macros are the ones that are created automatically and are always being recorded "behind the scenes" whenever you start an analysis from the Statistics or Graphs menus. The term "analysis" in STATISTICA denotes one task selected either from the Statistics or Graphs menu, which can be very small and simple (e.g., one scatterplot requested from the Graphs menu) or very elaborate (e.g., a complex structural equation modeling analysis selected by choosing that option from the Statistics menu and involving hundreds of output documents).

Whenever you choose any options from those menus, recording begins; the recording terminates when you exit the analysis, that is, when you click the final Cancel button to close the startup dialog. At that point, the recording is discarded and "forgotten" (unlike Master Macros; see What exactly is recorded in master macros?).

There are several things to remember when using the Analysis Macro recording facilities. All of these are consequences of the general "rule": Only actions performed as part of and during the specific analysis being recorded will be reflected in the Analysis Macros.

Datafile selections and operations. The recording of Analysis Macros begins automatically whenever a new analysis is started from the Statistics or Graphs menu. Anything that "happened" before that is not recorded in the Analysis Macro. Thus, your specific selection of the input data file is not recorded (the Analysis Macro always assumes that it is to be executed on the current active input data file) unless that choice is made by clicking the button on the respective analysis dialog. Neither are any operations recorded that you may perform on the input data file, such as sorting the data, subsetting of variables and/or cases, etc.  

Case selection conditions, case weights. Case selection conditions and case weights are only recorded if they are specified as part of the specific analysis, by clicking on the Select Cases or Case Weights button of the respective analysis; they will not be recorded in Analysis Macros if they are specified via the respective Tools menu options for the input data file (or if they have been specified prior to the current analysis for the respective input data file). Note that in STATISTICA, case selection conditions and case weights can be specified either (a) relatively permanently for input data files and automatically stored with the files, in which case they will automatically be used by all analyses based on the input data file, or (b) they can be specified on a per-analysis basis, in which case any new (subsequent) analyses will not use those specifications. In a sense, when you specify case weights or case selection conditions to "belong" to the data file, those specifications become part of the data file just like the data (numbers) themselves; when you specify case selection conditions and case weights for a particular analysis, those specifications are only applied to the respective analysis. To reiterate, case selection conditions and case weights are only recorded in Analysis Macros if they are specified via the respective analysis options (buttons), and regardless of whether or not they are specified for the current analysis only, or as a "permanent feature" of the data file.

Changing current datafile selection conditions and weights. Because case selection conditions and case weights can be recorded into Analysis Macros, in the exact same manner as specified via the Analysis/Graph Case Selection Conditions and Analysis/Graph Case Weights dialogs (when accessed via the respective buttons of the current analysis dialog), it is possible to reset the "permanent" current datafile selection conditions and weights by running an Analysis Macro. If you run an Analysis Macro that changes the case selection conditions for the current input datafile, then all subsequent analyses will use those specifications, and the results of those analyses will be affected accordingly.

Handling output: Sending results to workbooks, reports, etc. Like case selection conditions or case weights, the selections of output options (specifications) on the Output Manager are only recorded if they are made from the respective analysis that is being recorded (via the Output options on the respective analysis Options button menu); changes in the Output Manager are not recorded if they are made globally for all analyses via the Tools - Options menu. In keeping with the logic of Analysis Macros, only actions that are performed as part of a specific analysis are recorded.

For example, if you recorded an Analysis Macro without making any changes (from that analysis, via the Options - Output option available on every dialog of the analysis), then no information about specific settings of output options will be recorded. Consequently, when you run the macro, the output will be directed to the place(s) specified by the current default settings for the output. So, for example, while during the recording of a macro, results spreadsheets might have been directed to individual spreadsheet windows; when running the macro, and while different defaults are in place, the results spreadsheets might be directed to workbooks and report windows.