Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- BI
- /
- Visual Analytics
- /
- Percent difference from "fixed" previous period

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

05-03-2017 04:26 AM

HI -

I'm new to SAS VA and this community and would like to see if anyone here can help me to solve a problem I have when designing a report. I want to create a graph showing percent difference from a **fixed** previous period (the first date in my data). I do not really understand how I can achieve this from the optional settings in the aggregated measure editor. Does anyone have any kind of solution for this?

Kind regards,

Mats

P.S It doesnt have to be solved within the editor - any solution woud be greatly appreciated.

Accepted Solutions

Solution

05-03-2017
10:56 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

05-03-2017 08:42 AM

If the reference date can be hardcoded, then you could use the PeriodWithDate operator.

For example, you might use an expression like this to compare the values of Sales for each month to the value from JAN2015:

Period(_Sum_, 'Sales'n, 'Date'n, _ByMonth_) - PeriodWithDate(_Sum_, 'Sales'n, 'Date'n, _ByMonth_, '01JAN2015'd)

Documentation for Period() and PeriodWithDate() can be found here:

Hope that helps.

If the first date in the data set needs to be determined dynamically, I don't think that can be done easily in the expression editor. You will need to use SAS code in your data query to evaluate it.

Sam

All Replies

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

05-03-2017 05:09 AM

Well, I don't use VA so my answer here is going to be general SAS code. What I would do, and its per the models in my field, is to extract the baseline value, then merge that back to the original data. So (and you have not posted and test data in the form of a datastep so this is just example):

Some examplpe data:

Id Period Result

1 1 123

1 2 345

1 3 456

data base (rename=(result=base)); set have;

where period=1;

run;

data want;

merge have base;

by id;

run;

Now in this case, all records in the original dataset have a column base from the fixed period, and you can calculate across.

Solution

05-03-2017
10:56 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

05-03-2017 08:42 AM

If the reference date can be hardcoded, then you could use the PeriodWithDate operator.

For example, you might use an expression like this to compare the values of Sales for each month to the value from JAN2015:

Period(_Sum_, 'Sales'n, 'Date'n, _ByMonth_) - PeriodWithDate(_Sum_, 'Sales'n, 'Date'n, _ByMonth_, '01JAN2015'd)

Documentation for Period() and PeriodWithDate() can be found here:

Hope that helps.

If the first date in the data set needs to be determined dynamically, I don't think that can be done easily in the expression editor. You will need to use SAS code in your data query to evaluate it.

Sam

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

05-03-2017 10:57 AM

Thanks - both of you!