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 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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