Susan Slaughter

EG 4.2 Tip: Farewell to Informats

In Enterprise Guide, Everything, Little SAS Book Series, SAS on February 9, 2010 at 11:54 am

In Enterprise Guide 4.2, the Data Grid ignores informats.
Instead of informats, the Data Grid uses the data type and data group you specify to determine how to interpret any data values you enter. I say  it uses an “intelliformat” instead of an informat. Intelliformat is a term I made up since the developers don’t seem to have given this feature a name yet. This new way of handling input data is good–especially for non-programmers who may not be familiar with the intricacies of SAS informats.

However, I do have a couple of concerns. The first is that EG 4.2 still lets you specify informats (in the New Data wizard or the column Properties window). But there is no warning that the Data Grid  is going to ignore the informats you just specified. I’m sure there will be users calling SAS Technical Support to ask, “Why is my Data Grid ignoring my informat?” That’s why I’m warning you now.

My second concern is that there is currently no way to override the intelliformat behavior. So, if you want to type Julian dates into a Data Grid and have them converted to SAS date values, you’re out of luck. It can’t be done in EG 4.2. The default intelliformat for date values recognizes a lot of different types of dates, but not Julian dates. A similar problem exists for anyone who likes to use the $UPCASE. informat to automatically convert character data to uppercase.

It is possible to work around this limitation. (As you probably know, with SAS there is always a way to work around any problem.) Basically, you enter the data as vanilla numeric or character data, and then convert them either by inserting a new column in a Data Grid, or by computing a new column in a query. For example, if you have Julian dates, you would create the column using a data group of numeric (instead of date). Then you would convert the data by inserting a new column in the Data Grid. In the Insert window, you would specify a data group of date, and an expression that uses the DATEJUL function to convert the plain numeric values to SAS date values.

Enterprise Guide 4.2 Insert windowIf you create a computed column in a query, the process is similar. You use the DATEJUL function in an expression to convert the plain numeric values to SAS date values. There is one big difference though between doing the conversion in a Data Grid versus in a query. The Data Grid conversion is applied only once. If you make a mistake or type in more data values, you have to start over and create another new column. A query, on the other hand, will recreate the column every time you run it.

I should point out that informats are not entirely ignored in EG 4.2. You can still use them in SAS programs, of course. You can also specify an informat in the Import Data task when you read text or Excel files (thanks to Chris Hemedinger for reminding me!). I suppose you could also use them in an INPUT function. However, you won’t use informats much by pointing-and-clicking in EG 4.2.

  1. Susan,

    There is one other place that INFORMATs still work as expected: in the Import Data wizard. You can specify an INFORMAT on a field that you’re going to import, and SAS will read the value using that INFORMAT. That’s still pretty useful when using the Import Data task to read in a text file or Excel file with data values that need “special” treatment.

    Chris @ SAS

  2. Chris,

    Thanks for pointing that out. I had a feeling I was forgetting something. Yes, it is good to be able to specify an informat for a text or Excel file.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: