BookmarkSubscribeRSS Feed
Obsidian | Level 7



I have to create group by average column in cross tab(AVerage_Sales) in SAS VA 7.3 :-


  Month Jan-18 Jan-18
Manager Agent Sales Average_Sales
A ab 2 4
A bc 4 4
A cd 6 4
  Subtotal 12  
B ba 10 12
B cb 12 12
B dc 14 12
  Subtotal 36  


Can you guys please provide any input on this.

I have tried AVG[_GroupBY_] option it is not working and giving some absurd value.

The data granularity is on date from which month has been calculated.



Anurag RAi

SAS Employee

The problem is that you can't assign a fixed scope for the aggregation, so when you show the Agent column, you are getting the 'average' value for each Manager-Agent combination (i.e. that agent's sales).


There is a new feature in the latest Viya versions that allows the scope of the aggregation to be manipulated, but at 7.3 I think you might be able to get what you want with a hierarchy.  If you define a hierarchy on Manager->Agent, then your crosstab will have dynamically-expanding rows.  When Agent is collapsed, you will see the average sales for the manager's agents.  When the Agent is expanded, the Average Sales will show 'wrong' in the rows, but the subtotal for the Average Sales should be the what you want.


If you don't need the total sales for the manager, you could just change the aggregation type of 'Sales' to be 'Average' and you get the same effect with a single item.



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. 

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
  • 1 reply
  • 2 in conversation