Adding and Deleting Macros

Macros are added to a workspace via the Data Source Library. Access to this library is also provided by:

  • clicking on the drop-down arrow of any column in your table and then selecting Column List

  • clicking on the drop-down arrow of any column in your table and then selecting Macros > Add or Edit Macros

  • clicking Add or Edit Macros in the Change History panel

Adding text macros

  1. Click on the Data Source Library icon in the Data Prep Studio toolbar.

    The Data Source Library displays.

  2. Click Add Macro... as shown below.

     

  3. From the options that display, select TEXT MACRO.

    The Edit Text Macro dialog displays

     

    The Sample Values column shows combinations of text formats that you can clean.

  4. Click the drop-down icon located to the right of the Text field in the Sample Values column and then select a data-prep operation to apply to your text field.

     

    You can apply the following changes to text columns as macros:

    Change Type

    Details

    Case

    • Make Proper Case

    • Make Lower Case

    • Make Upper Case

    Clean

    • Remove Leading & Trailing Spaces

    • Remove Consecutive Spaces

    • Remove Specified Characters

    • Remove Non Alphanumeric Characters

    • Remove Numeric Characters

    • Remove Alpha Characters

    Extract

    • Starting from Left

    • Starting from Right

    • Using Position & Length

    • Between Start & End Text

    Insert Text

     

    Redact

     

    Replace

    • Ditto

    • Nulls

    • Blank Values

    • Using Find and Replace

    • Using Position and Length

     

  5. When you have finished selecting the changes you wish to apply to your text columns, click OK.

     

Adding numeric macros

The steps necessary to add numeric macros to your workspace are identical to those described above, except that you should select NUMERIC MACRO in Step 3.

You can apply the following changes to numeric columns as macros:

Change Type

Details

Compute

  • Round with Precision

  • Round Up (Ceiling)

  • Round Down (Floor)

  • Round Negative Signs (Abs)

  • Remove Decimals (Int)

Format

 

Replace

  • Ditto

  • Nulls

 

Adding date/time macros

The steps necessary to add date/time macros to your workspace are also identical to those described for how to add text macros above, except that you should select DATE/TIME MACRO in Step 3.

You can apply the following changes to date/time columns as macros:

Change Type

Details

Format

 

Replace

  • Ditto

  • Nulls

 

Deleting Macros

All of the macros you have created display in the Macros list of the Data Source Library.

To delete a macro, select the Delete icon located to its right.

 

Close the Data Source Library when you are finished.

 

 

© 2024 Altair Engineering Inc. All Rights Reserved.

Intellectual Property Rights Notice | Technical Support