BookmarkSubscribeRSS Feed
EnergizeK
Calcite | Level 5
Is anyone really familiar with either PROC GCHART or annotating datasets?

I'm trying to create a bar graph with the frequency counts on the inside and unique percentages for each group on the outside. I've successfully made the graph I want in PROC GCHART with the frequencies inside the bars. However I can't get PROC GCHART to pull the right percents--it keeps automatically using the percent of my GROUP variable "House_Age" when really I want the percent of my SUMVAR "Frequency". Is it possible to change which variable GCHART uses to calculate percents or do I need to find a way to do this manually with an annotate statement?

Here is my code:
proc gchart data=WORK.&DIRECTORY.;
vbar &RESULT. / DISCRETE GROUP=HOUSE_AGE
PATTERNID=MIDPOINT
type=sum
sumvar=Frequency
inside=sum
outside=pct
maxis=axis1
raxis=axis2
run;
QUIT;


Any advice will be warmly received!

Thanks a million,
Katie
2 REPLIES 2
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Possibly this SAS GCHART DOC link (and excerpt) may help:

http://support.sas.com/documentation/cdl/en/graphref/59607/HTML/default/gchart-bar.htm


With subgroups, PERCENT displays the percent contribution of each subgroup to the midpoint value of the bar, based on frequency. The PERCENT values for each subgroup total the percent contribution of the bar to the whole. For example, if the percent contribution of the whole bar is 60%, the PERCENT statistic for all the subgroups in that bar are 60% total. To calculate PERCENT based on the SUMVAR= variable, use the FREQ= and TYPE= options.


Scott Barry
SBBWorks, Inc.
deleted_user
Not applicable
Hi Katie,

I guess this might be the answer, once u use subgroup option in Var statement...........sub group and frequency variable


Syntax:subgroup variable name

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 642 views
  • 0 likes
  • 3 in conversation