howto

Parsing dates with DSS

May 23, 2015

Time series can be a pain to work with: there are many dates formats, differents timezones and components like "day of the week" are difficult to extract. Luckily, DSS provide some super helpful utilities for making this easier. In this post, we'll be using DSS to handle time series data.

The first challenge when working with time series is to convert the date columns in a good format. By good format we mean an interpretable format for the machine.

Preparation

For this example, we'll be using a basic dataset with two columns: date and value. You 'll notice that DSS automaticaly suggests that your date needs to be parsed. The simplest way to do this is to use a DSS analysis

In a preparation script, you can parse the date column easily. It is suggested as an action of your "Date (needs parsing)" columns.

After hitting Parse date, the Smart date window appears and suggests you the most suitable formats. You can see in green and red the valid and invalid examples. If none of them feels right, you can enter a custom format.

A new column is now created:

Now that your date is in a "proper" date format, a bunch of new operations is available like:

  • Extract date elements: year, month, day, day of week, week of year...
  • Compute time since a date, another columns, today.
  • Flag holidays.

Note: You can't use the date processors if your date isn't parsed before.

You can check the dates processors here:

Voila, you can now "Save as Recipe" your preparation script.

The User Guide has many more details. Did you know that DSS has great tools to handle these pesky timezone issues?