SAS Info Map: Need leading zeros on the account number?

This post was kindly contributed by Business Intelligence Notes for SAS BI Users - go there to comment and to read the full post.

When creating new variables, the SAS Information Map Studio opens the entire SAS format library to you.  These formats can be key to creating lots of new data items.  SAS format control the way data items appear.  In past articles I showed you how to create new data item using SAS functions and date formats. Check the SAS documentation to learn more about all the different formats available.

Creating new Data Items in SAS Information Map Studio

When data has been merged from various companies, such as when one company acquires another one, their data may be in different formats.  For instance, account numbers might vary from 8 characters in one company and 12 characters wide in the other. When this occurs one option is to use the widest account number and add zeros to the front of the smaller one to integrate the fields better.  You can do this easily within the information map using the Z format.  

From SAS Information Map Studio, you can create or modify the existing variable.  In this case I have two account numbers – 1 where there are only 3 characters and the other with 5 characters. The end result should be a 6 character long account number where the 0 are used to complete the blanks. 

  1. Create or modify the data item. In the Classifications, Aggregations, and Formats pane, select the Numeric format type and then navigate to the Z format.
  2. Adjust the total width of the field. This value should match the width of the account number after the zeros have been added.  In this example, the value is set to 6.
  3. For the result you can see that the zeros complete the field.  Australia account numbers have a default value of 5 so 1 zero was added, while Austria has a default value of 3, so 3 zeros were added.

sas bi information map studio using the Z format

 

In the upcoming Building Business Intelligence with SAS book, you can learn more tips and tricks for using SAS Information Map Studio. Sign up to have SAS Press send you an email when it’s available! 

This post was kindly contributed by Business Intelligence Notes for SAS BI Users - go there to comment and to read the full post.