logo Getting Started with SAS Enterprise Guide Main menubacknext
    

Add the Expression for the Computed Column

  1. In the Query Builder, click Computed Columns.

  2. In the Computed Columns window, click New.


  3. In the New Computed Column wizard, select Advanced expression, and then click Next.

  4. The profit column can be calculated by subtracting the wholesale price from the retail price and multiplying the result by the quantity of items that were ordered.

    You can either copy and paste this expression into the box at the top of the expression box or follow steps A–F to build the expression.

    (t1.UnitPrice - t3.UPRICE) * t3.QUANTITY

    1. On the Build an advanced expression page of the New Computed Column wizard, double-click Products under the Tables heading, located just below the row of operator buttons. Double-click UnitPrice to add it to the Expression text box.

      Advanced Expression Editor
      Click to view the full window.


    2. Click the subtraction operator (Subtraction operator button).

    3. Under the Tables heading, double-click Orders. Double-click UPRICE.

    4. Use your mouse pointer to highlight the expression, and then click the parentheses operator (Parenthesis operator button).

    5. Click the multiplication operator (Multiplication operator button).

    6. From the Orders table, double-click QUANTITY. Your expression should match the one below.

Expression shown in the Advanced Expression Editor
Click to view the full window.


  1. Click Next.

Next you rename the new column and add a format so that the values are in Currency format.

 

Main menubacknext