Products | Versions |
---|---|
Spotfire Statistica | 12.7 and higher |
"Data | Recode" only applies to a single variable at a time. If you need recode multiple variables in the same way, it will be quite handy to use SVB macro. This example shows one way to do it through recoding one variable and modifying its recorded SVB to perform the same recoding on other variables.
1. Start a master recording of your activities in Statistica
Select "Tools | Macro | Start Recording Log of Analysis (Master Macro)":
After click on "Start Recording...", a small dialog of recording of master macro will appear.
2. Now you can start to recode one variable. Go to "Data | Recode", specify your criteria to recode a variable and click "OK".
Example below: replace value "0" or "$0" of variable "Count1" to be blank (set "New Value 1 is blank) and keep other "unchanged"
3. After the recoding is done on the spreadsheet, stop the recording by click on the "Stop" button of the small recording dialog.
Give a name and save the SVB macro
The SVB macro for recoding a variable will be like:
4. Edit the SVB macro to include the recoding of other variables
e.g . copy and paste the SVB code for recoding a variable "Count1", and change the variable names in those codes to other variables that you want to recode, e.g. "Count2","Count3","Count4".
5. Ctrl+S to save the edited macro and Run the macro by clicking on the green arrow tab under "Macro".
You can also specify different recoding conditions/criteria for different variables in above SVB code.
The SVB macro code will do the batch recoding of multiple variables.