I am using SGPLOT (in SAS 9.4 1M4) to create a stacked bar chart. Each subject has 5 visits (Visit 1,2,3,4,5) and a dose at each visit. They have a total dose at each visit. My Y-axis is the total dose. The X-axis is each subject. Each stacked bar shows the total dose split up by visit. proc sgplot data=test; vbar subject / response=tot /* Total Dose at each visit by subject. So each subject has 5 records to capture total dose at a visit*/ group=visit /*Numeric 1,2,3,4,5*/ categoryorder=respasc /*Displays totals by ascending oder*/ /* grouporder=ascending ***This accomplishes the requirement to keep the visits in order. If I try to use both categoryorder and grouporder options together it does not work*/; xaxis label='Subject'; yaxis label='Total Dose'; run; Now in each stacked bar, I need to keep the visits in the same visit order (1,2,3,4,5) instead of their dose at each visit. So right now, if visit 4 has a smaller dose than visit 1, it shows up before (bottom of the stack) the visit 1 dose in the stack. I want the stack to always display visit 1 before visit 2 and so on for each subject while still displaying the stacks in ascending order of TOTAL DOSE. How can I accomplish this? Thanks, Vamsi
... View more