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;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
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.