BookmarkSubscribeRSS Feed
Qvika
Calcite | Level 5

Hi, 

I am having trouble making a bar chart from time intervals.

I have a start date (periodstart) and an end date (periodend) per customerID and I would like to make a bar chart per month from this data. The problem is that I don't know how to create an interval and that an interval can contain multiple months. Can somebody help me with this?

My dates look like this:

ID         periodstart       periodend

200      10JAN2018      15MAR2018

201      21FEB2018      14DEC2018

1 REPLY 1
Sam_SAS
SAS Employee

Hello,

 

A calculated item that computes periodend - periodstart should yield the number of days between the two dates. Because the numeric minus operator expects a number, you need to use the TreatAs() operator to perform subtraction on the date variables. That will look like this:

 

TreatAs(_Number_, 'periodend'n) - TreatAs(_Number_, 'periodstart'n)

 

The Schedule Chart object might also be of interest here, if it is available in the version of VA that you have.

 

Let us know if that helps,

Sam

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Tips for filtering data sources in SAS Visual Analytics

See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 359 views
  • 0 likes
  • 2 in conversation