BookmarkSubscribeRSS Feed
Obsidian | Level 7

I'm wonder if it it possible to display a day and month only as a date in a time series chart?  


As an example, 1Apr 2Apr 3Apr etc


I can't seem to find that format. If not, is there another way to achieve this? Because we are trying to compare 1Apr from 2019 for example to 1Apr 2020 so we can't include the years. Or do you think that I should just convert to a categorical value and use that in a line chart?


This is in SAS VA 8.5 or SAS Viya 3.5


Obsidian | Level 7

I actually found a way around it and created a MON-Day string format and used that in a line chart BUT I can't sort it.  It was initially something like 1-Jun but then I changed in to Jun-1 so I could sort better but obviously it's still not sorted correctly. Line charts, it seems, don't have the ability to sort by a hidden variable as a drop-down object would. any workarounds for this? 




Obsidian | Level 7

Actually, I found a workaround using custom sort by right clicking on the variable under the data section. All is good now! But ideally, another solution would be better but this works!

SAS Employee

You could create a custom sort, although it would be very tedious if there are 365 values.


ETA: You beat me to it 🙂

Obsidian | Level 7

Thank you for responding so quickly! Right now my list is short so it's manageable but it wouldn't be as you mentioned with 365 values.  Is there any way to customize the date further? I'm wondering why there is no day/month format in SAS.  It seems like a feature we would want in a time series? 

SAS Employee
You may want to create a SASWare Ballot idea for this:

Those posts are reviewed by the product team.

Meanwhile, it is possible someone else here will have a better workaround to offer.

Super User

My generic approach is to reshape data a bit prior to plotting:

data template;
   set have;
   plotdate = (month(date),day(date),1960);
   year = year(date);
Proc sort data=template;
by year plotdate;

Use the Plotdate as the xaxis variable with a format of Date5. , use year as a grouping variable to legend entries and different appearance in the plots for the years.

Obsidian | Level 7

Thanks! I will try this. I'm assuming though the SAS VA 8.4 time series chart will accept the DATE5. format from the dataset since there is no DATE5. format within SAS VA that I could find and that the time series will sort DATE5. correctly. 


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
  • 7 replies
  • 3 in conversation