Exploring, predicting and reporting with SAS Visual Analytics and SAS Visual Statistics

how to create group by average column in SAS VA 7.3 crosstab

Reply
Occasional Contributor
Posts: 17

how to create group by average column in SAS VA 7.3 crosstab

hi,

 

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.

 

Regards,

Anurag RAi

SAS Employee
Posts: 31

Re: how to create group by average column in SAS VA 7.3 crosstab

Posted in reply to anurag_rai_shines_gmail_com

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.

Ask a Question
Discussion stats
  • 1 reply
  • 97 views
  • 0 likes
  • 2 in conversation