Hello all,
My customer wants to compare day by day how much profit they made. As their sales are dependable of holidays like Easter, Christmass, Valentine, ... or even if it's a saturday or a friday.
They have created a calendar to map these special dates.I take the example of Easter. For example: in 2013 it was 15/04, in 2014 it was 4/4 and in 2015 it was 10/4 (as an example). The dataset contains one line for each day in 2015.
DateCurrentYear | DatePreviousYear |
---|---|
01/01/2015 | 02/01/2014 |
02/01/2015 | 03/01/2014 |
10/04/2015 | 04/04/2014 |
10/05/2015 | 09/05/2014 |
My dataset looks like this. I got all data from 1/1/2014 to today. The saledateLY is only filled in if the saledate is from this year.
SaleDate | SaleDateLY | Profit |
---|---|---|
01/01/2014 | 100 | |
01/01/2014 | 120 | |
04/04/2014 | 100 | |
10/04/2015 | 04/04/2014 | 156 |
10/05/2015 | 09/05/2014 |
Can I use the parallel period, or the relative period to calculate the differences between the profits made between days, weeks, months and use the special calendar?
Thanks
Filip
Hi Filip,
Unfortunately, the ParallelPeriod and RelativePeriod operators return a missing value when the smaller interval is by day.
There might be some workaround in how you build your dataset that would get the result you want, however.
Thanks,
Sam
Thanks for the answer.
I'm trying to create the dataset upfront. Thanks for the answer.
I have to do something similar at work to report enrollment comparisons for the current term compared to the previous year's term. Given a list of associated dates for the current year with the previous year, I create a table that translates the current date to the "comparative" one for the previous year. The "hard" dates are typically holidays like Labor Day. Otherwise I try to match the same weekday so that weekends match up. Once the table is created, it is easy to compare the appropriate dates.
Hope this helps.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.