Hello Experts,
Need your suggestions/help for the problem I am facing.
Here is the dataset, the code and the current output:
Dataset:
Period | Amount | Change |
31/03/07 | 100 | 3.5 |
30/06/07 | 110 | 3 |
30/09/07 | 116 | 10 |
31/12/07 | 125 | 4 |
31/03/08 | 118 | 3.2 |
30/06/08 | 128 | 3 |
30/09/08 | 135 | 3.5 |
31/12/08 | 140 | 4 |
31/03/09 | 145 | 2 |
30/06/09 | 153 | 12 |
30/09/09 | 130 | 1.5 |
31/12/09 | 135 | 1 |
31/03/10 | 120 | 1.5 |
30/06/10 | 140 | 2 |
30/09/10 | 152 | 1 |
31/12/10 | 164 | 2 |
31/03/11 | 175 | 1.5 |
30/06/11 | 180 | 15 |
30/09/11 | 188 | 2 |
31/12/11 | 195 | 1.7 |
CODE:
/*****************************************************/
symbol1 value=dot height=0.25 interpol=join color=red;
axis1 minor=none label=(angle=90 "change") ;
axis3 minor=none label=("Year") ;
axis2 minor=none label=(angle=270 color=red "amount") value=(color=red);
proc gbarline data=GBARLIN1;
bar period / discrete type=mean sumvar=change raxis=axis1 maxis=axis3 inside=mean width=8 space=4;
plot/sumvar=amount axis=axis2;
format period year4.;
format change 4.1;
format amount 3.;
run;
quit;
/*****************************************************/
Current OUTPUT:
The issues are:
1) For the plot , I needed the amount to be plotted and not their SUM or MEAN...That is no statistics...How do I achieve this?
2) Can I plot all the values on the line (i.e., all the quarter values) not just values at midpoint? (that is the bars will be yearly mean of one of the
variable(change) while plot should be representing the exact value of the other variable (amount) for all the quarters (but no mean/sum) )
Thanks!
Hello Experts,
Please help me with your suggestions!!
-VK
The reason your periods are grouped is the use of : Foramat period year4.; which is telling SAS to group and display by year. Use YYQ6. YYQS8. or similar.
If the data is already summarized as it appears in your case the choice of statistic doesn't matter but the procedure does expect to have a statistic. I think with the format change above you'll get what you're looking for.
Thanks Ballard for you reply. Your explanation is correct!
But, I have used YEAR4. because I want yearly average per BAR...
and for the plot I wanted all the points plotted. But the problem is that the plot is plotting at midpoints only. Is there some trick to have plot display all the values?
In short, for BAR... it should group while for PLOT it should not group.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.