## Column Percentage in bar

Regular Contributor
Posts: 185

# Column Percentage in bar

I want to show column percentages in a bar chart that comprises of two bars. See the image below -

I am showing frequency distribution of 2 groups in the chart. In SAS VA, it calculates FREQUENCY PERCENT taking total count as base in denominator instead of taking count of a particular group. I am able to figure it out in CROSS TAB but not able to calculate in charts.

SAS Employee
Posts: 35

## Re: Column Percentage in bar

Ujjawal:

Before I answer Yes or No (for out of the box funcitonality) or Yes or No (for customized functionality via something like VA Custom Graph Builder or some other mechanism), I need to ask a clarifying question 1st ...

At the bottom of each bar (respectively) in your provided bar visual, going left to right ... are you expecting 20% (instead of 18%), 48% (instead of 33%), 33% (instead of 5%), and 98% (instead of 44%) respectively?

Or am I missing the gist of your question?

Perhaps a compare/contrast screen capture ... SAS VA vs. something else (e.g. Excel)?

Sincerely,

Ted Stolarczyk, SAS Customer Loyalty team

Regular Contributor
Posts: 185

## Re: Column Percentage in bar

It's my bad i am showing wrong values at the bottom of each bar. I forgot to select "Bands" while preparing chart.

At the bottom of each bar in provided bar visual, going left to right ... i am expecting "AA" "BB" "CC" "DD".

Please let me know incase any question(s)

SAS Employee
Posts: 35

## Re: Column Percentage in bar

:

So is this what you are looking to generate in VA?  This was created with basic VA bar chart functionality (no Custom Graph Builder utilized here) ...

Regular Contributor
Posts: 185

## Re: Column Percentage in bar

Thanks! This is what i am looking for. Could you help me with the aggreagated measures you have used? I am new to SAS VA. I am unable to create aggregated measures for each of the groups.

Regular Contributor
Posts: 185

## Re: Column Percentage in bar

I am in urgent need of it. I want to complete the dashboard by end of the day. Can someone please respond on it? How the aggregated measures are built for the chart shown below?The percentages are column percentages of the total as shown in the table below. The percentages add upto 100%.

SAS Employee
Posts: 35

## Re: Column Percentage in bar

Ujjawal:

See attached PDF file that has screen captures series of steps to take.

In addition, if you are new to custom calculations and aggregations within VA, I'd suggest watching this recorded webinar on the topic (and its corresponding material):

view the on-demand version

presentation slides

Q&A topics

Sincerely,

Ted

Regular Contributor
Posts: 185

## Re: Column Percentage in bar

Thank you so much for your reply and providing useful materials about aggregated measure. Unfortunately, i don't have summarized variables - "GrpACount" and 'GrpBCount" in my data. They are raw values in my data. How can i create these 2 summarized variables? My raw data looks like below -

 Group Bands A AA A AA B BB A BB A CC B AA B BB B CC B AA A CC A DD A DD B DD B DD
SAS Employee
Posts: 35

## Re: Column Percentage in bar

:

Are you e-mailing from the U.S.?

SAS U.S. Operations is closed for Memorial Holiday.

Is there a local SAS Tech Support # you can call?

http://www.sas.com/en_us/contact.html#m=international-offices

Sincerely,

Ted

Regular Contributor
Posts: 185

## Re: Column Percentage in bar

I am emailing from India. The local tech support must be closed at this time as it's mid night in India. You enjoy your holiday. Thank you for your reply. It would be a great help if you solve it tomorrow.
SAS Employee
Posts: 35

## Re: Column Percentage in bar

:

You're going to need to pre-summarize your data prior to loading it into SAS VA so that there is 1 line item (1 row) per each Band.

So that for each Band, you have a GroupACount and a GroupBCount (then you can do those Aggregations I mentioned in earlier post replies).

I'm not a SAS data step programmer ironically but I "Googled" the WWW to get sample code and I ran it on the subset of your raw data you last posted.  Proc Freq can get you the counts, then Proc Transpose to a wide dataset.  For example ...

proc freq data=WORK.UJJAWAL_RAWDATA_SAMPLE noprint;

table BANDS*GROUP / out=temp sparse;

run;

proc transpose data=temp out=want (drop=_;

by BANDS;

id GROUP;

var COUNT;

run;

At this point, if you need continued detailed assistance, I would need to defer you to your local SAS India Tech Support.

Sincerely,

Ted Stolarczyk, U.S. SAS Customer Loyalty team

SAS Employee
Posts: 35

## Re: Column Percentage in bar

When I copy/paste the PROC TRANSPOSE code, it makes a smiley face for some reason.

So here's a Print Screen of it ...

Posts: 1,406

## Re: Column Percentage in bar

What awesome customer service - helping out with SAS code when you're not a programmer and also on your memorial day weekend! :-)

FYI, the smiley face appears as you have the characters : and ) next to each other.  To avoid this, it is best to use the SAS code formatting block when pasting SAS code into the SAS Support Community. When replying using the Rich Text mode, you'll see the running man icon on a notepad. Use this icon to bring up the "Insert SAS code" dialog to paste your SAS code. There is some information on this at https://communities.sas.com/t5/Getting-Started/How-to-add-SAS-syntax-to-your-post/ta-p/224394

Kind Regards,

Michelle

Community Manager
Posts: 3,462

## Re: Column Percentage in bar

I'll second my thanks to @TedStolarczyk for responding here.  For @Ujjawal and anyone else getting started with SAS Visual Analytics, I think it's worth spending the time to learn from the experts in the recorded (and sometimes LIVE) Ask the Expert sessions.  There are several available right now for SAS Visual Analytics:

 SAS Visual Statistics: Getting Started    This session introduces SAS Visual Statistics and its capabilities. You see how you can apply statistical modeling techniques to explore data visually. Watch on-demand SAS Visual Analytics: An Introduction to Custom Calculations and Aggregations    The interface of SAS Visual Analytics enables you to calculate new data items from your existing data items using an expression builder; you can calculate a company’s profits by subtracting expenses from revenues. In addition to performing calculations on numeric values, you can use calculated data items to create date and time values. Watch on-demand SAS Visual Analytics: Getting Started    This session introduces you to the components of SAS Visual Analytics, including the Home Page, the Explorer, and the Designer. It also introduces the Viewer and Mobile BI, the interfaces for viewing SAS Visual Analytics reports. Watch on-demand SAS Visual Analytics: Tips and Tricks for Users   This session will provide you with options, tips & tricks, and best practices when using SAS Visual Analytics for data exploration and report design. Watch on-demand

Find these and many other Expert sessions at the Ask The Expert site on support.sas.com.

Regular Contributor
Posts: 185

## Re: Column Percentage in bar

Thank you everyone for reply. I appreciate such an awesome customer support. I thought it would not be so Complex. I would like this functionality to be added in coming version of SAS Visual analytics product as it's a common feature in dashboard.
Discussion stats
• 14 replies
• 1003 views
• 5 likes
• 4 in conversation