I am using PROC SGRENDER in order to create a barchart of two groups at eight different time points. At the top of each bar I want to show the confidence intervals.
My dataset contains 16 records with the value of each bar ("a_rate") for each of the two groups ("group_id") at each time point ("period") already calculated. It also contains the values for the error bars ( "ll_ci", "ul_ci" ) as well as a variable "g_order" with values from 1 to 16 according to the data ordering (=_n_).
The problem is that in the options of the barchartparm statement, it seems that the options "group=…" and "errorlower=… errorupper=…" cannot work simultaneously.
If I use only the "group=group_id" option then the bars are displayed in two separate colors according to their grouping ("group_id" variable).
If I use only the "errorlower=… errorupper=…" options, I get the error bars displayed for each bar.
But if I use both options then only the "group=…" option seems to work since the error bars are not displayed at all.
Also, is there a way of defining the space between the bars of the same group as well as the space between bars of different time points? (what I want to do is to have at each time point the 2 bars together – no space – but a small gap between the bars of different time points).
To handle your second requirement, I recommend a little different structure for your graph. Try using a LAYOUT DATALATTICE. You can then set the BARWIDTH=1 to create no space between your bars and use the COLUMNGUTTER option to control the space between periods. There are other options to move the column headers if you want. Hope this helps!
Problem 1 solved! The code you suggested works fine! The error bars display correctly together with different color for each bar/group.
As far as the solution suggested for problem 2, I am working on it. The problem is that this way I get a grid of 8 barcharts (as many as the periods) one next to the other, where in each barchart only the bars for the specific period are displayed but together with the whole plotted area (i.e. all 8 periods in each x-axis ).