BookmarkSubscribeRSS Feed
rjassem1
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

 

7 REPLIES 7
rjassem1
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? 

 

 

 

rjassem1
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!

Sam_SAS
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 🙂

rjassem1
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? 

Sam_SAS
SAS Employee
You may want to create a SASWare Ballot idea for this:
https://communities.sas.com/t5/SASware-Ballot-Ideas/idb-p/sas_ideas/label-name/sas%20visual%20analyt...

Those posts are reviewed by the product team.

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

Thanks,
Sam
ballardw
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);
run;
Proc sort data=template;
by year plotdate;
run;

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.

rjassem1
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. 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 2005 views
  • 3 likes
  • 3 in conversation