BookmarkSubscribeRSS Feed
jins
Fluorite | Level 6

New to Visual Analytics and trying to find a way for creating an interactive report to display weighted and unweighted values (mean, median) with a drop-down menu for various variables.  Is this dynamically possible? 

2 REPLIES 2
TSBruce
SAS Employee

I am not sure exactly what you are trying to do without more details, but you can find an example on how to calculate a weighted average at https://blogs.sas.com/content/sgf/2014/10/24/how-to-calculate-the-weighted-average-in-sas-visual-ana...

If you want the value of the weight to be dynamic, you could create a parameter that is passed to this calculation.  Documentation on parameters can be found at https://go.documentation.sas.com/doc/en/vacdc/v_029/vareportdata/n1wv50n60ccq86n1nzp6zat1wj64.htm

You can also specify the aggregation for a measure to AVERAGE or MEDIAN using the attributes of any data item.  You can also duplicate a data item if you want to have multiple aggregations defined for the same measure.

Hopefully this will get you headed in the right direction.

jins
Fluorite | Level 6

Weighted average should be fine but what about weighted median in Visual Analytics? I'm comparing this to the "weight" option in proc means. 

Example below shows the weighted average which can be done in multiple steps in Visual Analytics using Aggregated Measure (Sum(ByGroup,var*wgt)/Sum(ByGroup,wgt)). What about the weighted median?

varwgtvar*wgt 
111 
224 
339 
4312 
5315 
 12413.416667

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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