Hi All,
Following code gives me histogram showing total count in Y axis. Can someone tell me how do I get average instead of total count? Thanks.
proc sgplot data=have;
vbar Start_Date / stat=freq
groupdisplay=cluster group=event;
keylegend / location=inside position=topright;
where event in ('volley ball','soccer') and Start_date between "01Mar2014"d and "30Apr2014"d;
format Start_Date weekdate10.;
run;
A histogram by definition shows frequency.
Change the STAT= in the VBAR statement - to MEAN instead of FREQ to plot a bar chart with the mean value instead of counts.
Hi Reeza,
Changed that to mean, still not working. can you please tell why.
proc sgplot data=have;
vbar Start_Date / stat=mean
groupdisplay=cluster group=event;
keylegend / location=inside position=topright;
where event in ('volley ball','soccer') and Start_date between "01Mar2014"d and "30Apr2014"d;
format Start_Date weekdate10.;
run;
Can you post some sample data and explain what 'still not working' means?
Hi Reeza,
I have Feb and Mar data of both 2014 and 2015.
Thanks,
Date | Outcome |
01-Mar-2014 | Loss |
27-Feb-2015 | Profit |
27-Feb-2014 | Loss |
24-Feb-2014 | Profit |
01-Mar-2015 | Loss |
26-Feb-2015 | Loss |
01-Mar-2015 | Loss |
01-Mar-2015 | Loss |
01-Mar-2015 | Loss |
01-Mar-2015 | Profit |
01-Mar-2014 | Profit |
01-Mar-2014 | Profit |
01-Mar-2014 | Profit |
25-Feb-2014 | Profit |
What are the numbers you're trying to take the average of?
HI Reeza,
I created a frequency table from the above table call Table_freq. It has the no of outcome (both loss and profit in one column though) on each date. I tried to run that report from that table with the following code.
Thanks for your help.
proc sgplot data=Apple.Table_freq;
vbar Date / stat=freq
groupdisplay=cluster group=Outcome;
keylegend / location=inside position=topright;
format Start_Date weekdate10.;
run;
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!
Use this tutorial as a handy guide to weigh the pros and cons of these commonly used machine learning algorithms.
Find more tutorials on the SAS Users YouTube channel.