Hello there, I'm trying to create a graph with SGPLOT that shows rates by hospitals in two seperate panels: Level_1_2 and Level_3. With the dataset I'm currently using, the problem is, I cannot divide the panels the way I want it. The final graph is supposed to have the rates for each hospital within their "level". Currently the graph I produce includes Level_3 hospitals in the Level_1_2 panel and Level_1_2 hospitals in the Level_3 panel. Do you think I set up my dataset not "optimally" or am I missing something in the SGPANEL? Also, if its a possibility I would like to create two seperate REFLINES for each panel. Thanks a lot for your help in advance! Here are my dataset, code, and the graph. hosp_name level cpred_final clower_final cupper_final VGH Level_1_2 27.8587 26.0588 29.7581 VicGH Level_1_2 21.7479 19.824 23.8298 RCH Level_1_2 19.2273 17.5596 21.0323 KGH Level_1_2 19.0601 16.8262 21.5502 RIH Level_1_2 17.7454 15.5962 20.1532 UHNBC Level_3 13.5041 11.1077 16.3623 NRGH Level_3 10.9852 9.0805 13.2551 LGH Level_3 10.9797 9.2928 12.9473 ARH Level_3 10.4652 8.5618 12.757 SPH Level_3 8.8174 6.8647 11.2857 proc sgpanel data=Results noautolegend; panelby level/columns=2 novarname; rowaxis values=(0 to 30 by 5) grid; colaxis grid; scatter x=hosp_name y=cpred_final / markerattrs=(symbol=circle color=red size=8) DATALABEL=cpred_final DATALABELATTRS=(color=black /*weight=bold*/) DATALABELPOS=right yerrorlower=clower_final yerrorupper=cupper_final; refline 21.13 10.95/label=('Level 1&2 average: 21.1%' 'Level 3 average: 11.0%'); title h=12pt justify=left bold italic 'Figure 2: Adjusted predictions at the average risk score by hospital'; format cpred_final 4.1; run;
... View more