Workflow: Creating new variables in a dataset with the Mutate block


The Mutate block enables you to create a new dataset variable based on existing variables in the dataset.

The following demonstrates how to use an expression in the Mutate block to create a new variable in the loan_data dataset (containing observations each of which describes a completed loan and the person who took the loan out). The new variable is_human? initially contains the default value Yes:

  1. Import the loan_data.csv dataset onto a Workflow canvas using the Text File Import block.
  2. Expand the Data Preparation group in the Workflow palette, then click and drag a Mutate block onto the Workflow canvas.
  3. Click the Output port of the loan_data dataset block and drag a connection towards the Input port of the Mutate block.
  4. Double-click the Mutate block to display the Mutate Editor view.
  5. In the Mutate Editor view:
    1. From the Variable Definition pane, in the Name dialog box, type Is_Human?.
    2. In the Expression text box, type 'Yes'.

  6. Click OK to save the configuration and close the Configure Mutate dialog box.

A green execution status is displayed in the Output port of the Mutate block and the new Working Dataset. The Mutate block output dataset contains the input loan_data with the new Is_Human? variable.