BookmarkSubscribeRSS Feed
dakuwan
Obsidian | Level 7

I have a report that will be published year to year and I'd like to cut down on the maintenance needed.  I have a lot of aggregated measures for example.  

 

Here's some sample code:

Sum [_ByGroup_] ('Ordered 2017'n) - Sum [_ByGroup_] ('Ordered 2016'n)

 

I have a chart which has the year as a category.  So next year the columns will be 'Ordered 2018' and 'Ordered 2017'.  Is it possible for me to do something that will dynamically adjust these column names in the code so that they're not hardcoded and will always be the current year and current year-1.

 

Thanks

2 REPLIES 2
LinusH
Tourmaline | Level 20
Having measures variables created according to time is awkward, it's more like an Excel layout.
That said, it isn't obvious how to deal with calculations like yours in VA, makes one miss OLAP cubes sometimes....
I don't have access to VA at this point, but a vague idea.
First restructure your data so you have a time classification variable instead (like year, if that is your preferred granularity).
Then you perhaps could use the ParallelPeriod periodic operator to retrieve last years values.
http://support.sas.com/documentation/cdl/en/vaug/69957/HTML/default/viewer.htm#n1lxnqfip132can1hdzue...
Data never sleeps
SASKiwi
PROC Star

SAS VA formulas can only be changed manually so you would be stuck with editing your code each year. Best practice in VA would be to use relative definitions like current year and last year.

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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
  • 2 replies
  • 1547 views
  • 0 likes
  • 3 in conversation