How can I record my analysis in an SVB program?
There are three categories of macros that can be automatically created as you run Statistica:
All three follow the identical syntax and can be modified at a later time, but because of the different ways in which each of them is created, they offer distinctive advantages and disadvantages for specific applications (for details, see also What exactly is recorded in analysis macros?, and What exactly is recorded in master macros?).
- Analysis Macros
- First, you can record simple Analysis Macros from an analysis to record the settings, selections, and chosen options for that specific analysis. [Note that 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).] After selecting any of the Statistical options from the Statistics menu or graphics options from the Graphs menu, all actions such as variable selections, option settings, etc. are recorded "behind the scenes"; at any time you can then transfer this recording (i.e., the Visual Basic code for that macro) to the Visual Basic program editor window. Note that the Create Macro command is available from every analysis via the Options menu or the shortcut menu (accessed by right-clicking the analysis button) when the respective analysis is minimized.
Also, your choice of datafiles, as well as case selection conditions and the weight variable, are recorded as long as those options are selected in the analysis dialog (i.e., via the button menu and not from the File menu or the status bar). One such "stand alone" macro is created for each analysis and these macros are not "put together" automatically by Statistica (in fact they cannot be "mechanically" combined without some editing since each of them represents a stand-alone program that starts with the appropriate declarations, etc.).
- Master Macros (Logs)
- Second, you can record a Master Macro or Master Log of your entire analysis; this recording will "connect" analyses performed with various analysis options from the Statistics or Graphs menu. However, unlike simple Analysis Macros, you can turn the recording of Master Macros on or off. The Master Macro recording will begin when you turn on the recording, and it will end when you stop the recording. In between these actions, all file selections and most data management operations are recorded, as are the analyses and selections for the analyses, in the sequence in which they were chosen.
The most common application of the Master Macro would be to start Statistica, start the Master Macro recording by selecting Start Recording Log of Analyses (Master Macro) from the Tools - Macro menu, and then continue with the analyses. For example, you can compute descriptive statistics, perform some multiple regression analyses, make several histograms and scatterplots, etc. Note that during the analysis, you will see the floating Record toolbar to remind you that you are currently recording a Master Macro.
Finally, you stop the recording by either clicking the stop button on the floating Record toolbar (see above) or by selecting Stop Recording from the Tools - Macro menu. At that point, the Visual Basic program that represents all actions performed or selections made during the Master Macro recording will be transferred into a Statistica Visual Basic editor window. When you run this macro "as is," the exact same analyses will be repeated (with some exceptions resulting from the logic of creating reusable programs from sequences of interactive operations performed by the user, described below).
- Keyboard Macros
- When you select Start Recording Keyboard Macro from the Tools - Macro menu, Statistica will record the actual keystrokes you are entering via the keyboard. The floating Record toolbar will be visible as a reminder that a recording "session" is in progress.
When you stop the recording by either clicking the stop button on the floating Record toolbar (see above) or by selecting Stop Recording from the Tools - Macro menu, a Statistica Visual Basic editor window will open with typically a very simple program containing a single SendKeys command with symbols that represent all the different keystrokes you performed during the recording session.
Note: this type of macro is very simple in the sense that it will not record any context in which the recorded keystrokes are pressed and will not record their meaning (i.e., commands that these keystrokes will trigger), but this feature makes them particularly useful for some specific applications. For example, it can be very useful when it is attached to a keyboard shortcut (select Customize from the Tools menu to display the Customize dialog; then select the Keyboard tab, where you can attach the program to a shortcut key) where it could be used, for example, to quickly reenter long text, a formula, a selection of variables, or a large number of options (via keystrokes) on some complex dialog.