I'm going to show you a step-by-step approach, with the warning that I might not program it this way in real life. I might look for ways to combine some of these steps. If you are actually processing tens of millions of records, we can look at some of the alternatives.
Prepare the data by first creating all the variables you might need.
year = year(creation_date);
month = month(creation_date);
if validation_date > . then validated = 'Y';
if sold_out_date > . then sold_out = 'Y';
if creation_date > . then created='Y';
Then summarize as needed to get the various subtotals you require:
This gives you a data set that is ready (or at least close enough) for printing. You can experiment with it, fiddle with it if you would like (for example, converting month to a 3-letter abbreviation) since this is a small data set and won't take too much time to process.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.