howto

Parsing dates with DSS

Applies to DSS 1.0 and above | 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

A dataset with a date column

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

Visual analysis, Parse date action on date column

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.

Select date format for date column being parsed

A new column is now created:

Parsed date column in the visual analysis

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:

Context menu options for parsed date

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?