Hello and good morning!
I wanted to know if anyone could spell out how I can go about creating a timeline to express year over year differences. I imagine it is something that is simple and I have just been looking in the wrong places. What I mean is I would like to have a chart that goes from:
To:
Please forgive my horrible drawing.
Thank you for your assistance!
I think you want to visualize it like this, right?
The quick calculation for YOY growth is super useful! But to visually compare the two years' data you will need to make a calculated item using the ParallelPeriod() operator.
This operator has a ton of parameters, but just refer to the doc and the tooltips 🙂
Here is the expression I used for the chart above:
This expression returns the value for the same month of the previous year, so you can take this calculated item and plot it alongside the original measure.
Let us know if that helps!
Sam
Hey Jeffrey,
For YoY, use the Quick Calculation available from the Data Pane - https://go.documentation.sas.com/doc/en/vacdc/v_018/vareportdata/p1vsphor4qnevcn13p4bepmj5wwx.htm
-Robby
I think you want to visualize it like this, right?
The quick calculation for YOY growth is super useful! But to visually compare the two years' data you will need to make a calculated item using the ParallelPeriod() operator.
This operator has a ton of parameters, but just refer to the doc and the tooltips 🙂
Here is the expression I used for the chart above:
This expression returns the value for the same month of the previous year, so you can take this calculated item and plot it alongside the original measure.
Let us know if that helps!
Sam
Thank you very much Sam_SAS that was wonderfully helpful!
I was wondering if you have ever run into this before? I am seeing the months from 1960 which I am assuming is some sort of error in the calculation, here is the calculation from 2022 and 2023:
SAS dates are stored as numbers based on January 1960, so I think somewhere along the way you are using numerics as dates.
Is it possible you are using the wrong variable for the date?
It is very likely, I will look into this and see what I did on my end!
The solution a mistake on my end, I had only the Month Displaying and not MMYYYY.
I have one last question and Need a little more guidance, for some reason I am getting 2 datapoints for each month, is there a way to ensure it just shows 1 month for each point?
I'm not sure I understand -- you want to display a line chart with two lines, right?
Or did you just want to chart the difference? You could use the quick calculation if so.
No problem!
At the bottom of the chart, you see each month is listed 2 times, for example, one is on April 1 and the other is April 16th, then March 1 and March 16th.
Is it possible to just have "April" and "March" listed only 1 time?
Ah! You want the ticks on the horizontal axis to only be 1 per month. I think the actual data for the chart only has 1 value, but two axis ticks are shown.
If you set the format on your date variable to be a month format like MMMYYYY, that should do the trick.
VA doesn't like to let you change the format of a variable when it is used in a calculation, so what you might want to do is:
1. Duplicate the existing variable and set the desired format
2. Edit your calculated item and replace the variable with the duplicate.
3. Replace the variable in your chart with the duplicate.
That should work, and be less of a pain from deleting everything that uses the variable and re-creating it.
Sam
Hello! I was out of the office! thank you for your response.
I found the solution and as silly as it was, it was just because the widget was too large, once I shrunk it down I only had 1 data point for each month.
Have a wonderful day!
Thanks for letting us know!
The axis tick values are automatically thinned when the report is displayed at a smaller size. But changing the date format should ensure that only a single tick is displayed per month, regardless of how large the report object is displayed. I would recommend this if it is important to you and you are not sure how consumers of the report might display it.
Thanks,
Sam
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.