BookmarkSubscribeRSS Feed
anuragraishines
Quartz | Level 8

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

1 REPLY 1
MikeJenista
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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 1242 views
  • 0 likes
  • 2 in conversation