Rules Builder

Ribbon bar: Open a data set. Select the Data tab. In the Transformations group, click Rules Builder to display the Rules Builder.

Classic menus: Open a data set. From the Data menu, select Rules Builder to display the Rules Builder.

The Rules Builder can also be accessed in a Workspace node. Open a workspace and a data file. Display the Node Browser, insert a Rules node, double-click the rules node to display the Edit Parameters dialog box, and click the Edit button to display the Rules Builder.

Element Name Description
Open Displays a menu where you can choose to Open from file a rules file that has been saved or Open from Enterprise a rules file that has been saved to Statistica Enterprise
Save Displays a menu where you can choose to Save to Enterprise or Save to File as an .srx file, the newly created rules, or Export Offline Rules. When you select the latter command, you are prompted for a file path name to save the offline rules to. All ImportRules statements are replaced with the actual rules, and all EvalModel statements referring to models in Enterprise are changed to ones referring to models in local PMML files which are saved in same location as the offline rules
Edit Displays a menu containing editing commands

Insert

Select Insert to display a submenu containing the following commands.

Note: These commands are available only for the tree view.
Command Description
If() Displays the Edit If Condition dialog box, where you can enter an expression that evaluates to a true or false (nonzero/zero) value. The Edit If Condition dialog box can also be displayed by double-clicking on an If condition in the tree view
ElseIf() Displays the Edit If Condition dialog box, where you can enter an expression that evaluates to a true or false (nonzero/zero) value. The Edit If Condition dialog box can also be displayed by double-clicking on an ElseIf condition in the tree view
Else Displays the Edit If Condition dialog box, where you can enter an expression that evaluates to a true or false (nonzero/zero) value. The Edit If Condition dialog box can also be displayed by double-clicking on an ElseIf condition in the tree view
Variable=Formula Creates derived variables (also known as calculated variables). Select this command to display the Edit Formula dialog box, which contains options to edit the formula. The Edit Formula dialog box can also be displayed by double-clicking on a formula in the tree view
Variable=Model Displays the Choose Model dialog box, which contains options to select an existing model for execution
Import Rules Displays the Import Rules dialog box, which contains options to import existing rules from a file or from Statistica Enterprise
Push Array Displays the Push Array dialog box. An array contains a list of values. It can be numbers like 1, 20, 5. It can contain text that has weights like Hot 100, Cold 0, Ignore -100. It can contain text like Hot, Cold, Ignore. This command is used to add or set values for an array based on conditional execution of the rules. Rules can then be written to get values from the array with Array Max to perform other tests or set reason codes for output
Array Max Displays the Array Min/Max dialog box, that contains options to get values from the array that were added with Push Array. If the array contains text with weights, Statistica uses the weight to determine the minimum or maximum and return the associated text. If the array contains just text, the minimum or maximum is based on alphabetical order
 Push("COUNTER", "ONE")
         Push("COUNTER", "TWO")
         Push("COUNTER", "THREE")
         Min_Variable = ArrayMin("COUNTER", 1)
         ; Returns text value of ONE
         Max_Variable = ArrayMax("COUNTER", 1)
         ; Returns text value of TWO.

Alphabetical order is ONE THREE TWO

Comment Displays the Edit Comment dialog box, where you can enter a comment to insert. You can also double-click on a comment in the tree view to display the Edit Comment dialog box, and then edit the comment
Declare Declare a variable when you need an embedded rule to modify a variable and pass it to another set of rules. This allows you to parameterize rules and treat it like a function.

Secondary Rules

Declare x, y
        z = x+y

Main Rules

x = 1
         y = 2

ImportRules(Secondary Rules)

Delete Selected Select a rule, and select Delete Selected option from the Edit menu to delete the selected rule. You can also right-click on a rule and select Delete Selected option from the shortcut menu to delete the rule. When deleting an if clause, all the rule steps in the if clause are removed as well as all associated elseif/else clauses and their rule steps. If deleting an elseif or else clause, only that clause and its rule steps are removed, leaving any other elseif/else clauses, as well as the initial if clause.
Delete All Select Delete All option from the Edit menu to delete all the rules. You can also right-click on an item in the tree view and select Delete All from the shortcut menu
Output Variable Specs Select this command to specify the data type of the results variables in the results spreadsheet. By default, values are always numeric, with text labels being used for any text. But, by using the Output Variable Specs option, you can use the Statistica Variable specs dialog box to specify an actual text variable with specified length, or integer/byte numeric values. You can also specify the display format and missing data code using this option
Undo You can undo the last edit to the rules by pressing CTRL+Z on your keyboard, or by selecting Undo option from the Edit menu
Go To Line The Rules Builder contains a Line Number of the rules in both tree view and text view. Since the line number is included in per-case error reporting, this can be used to determine which rule generated errors during rule execution. Select Go To Line command to display the Enter Line Number dialog box
Find To search the rules, select the Edit Text option button, click the Edit button, and from the menu, select Find to display the Find dialog box
Repeat Find/Replace Select this command to repeat the last find or replace you conducted
Replace Select this command to display the Replace dialog box
Edit in Tree Select this option button to enter or edit rules using the default tree view. Rules can be moved in the tree view by selecting the rules and dragging them to the new location
Edit Text Select this option button to enter or edit rules using the text editor view. The text editor makes it easier to move rules steps within a particular set of rules, or copy between rule sets. For more information, see the Text Syntax topic.