1. Launch Statistica and create an analysis of choice.
2. Expand the minimized analysis bar and click on Options >> Create Macro.
Alternatively, if you know the analysis options to be recorded even before viewing the results, you may click on the create macro from the analysis dialog as shown below: