06-29-2017 07:58 AM
i would like to perform the graph in attachments.
I thought that it was possible usng Hbar with sgplot, but it does not.
The problem is that some period are repeating (in this case "Home").
Do you think that it was possible with SAS v9.4? What procedure?
Thanks for your support
06-29-2017 09:32 AM
I suggest to use the HIGHLOW plot statement, you have to prepare the data accordingly.
See below for an example, that gives you some ideas:
data highlow; infile cards dlm="," dsd missover; input patient : $32. low high type $ labelPoint labelValue $ ; cards; patient1 someDate,0,20,hospital,10,20 patient1 someDate,20,40,ward,, patient1 someDate,40,50,hospital,, patient1 someDate,50,52,home,, patient1 someDate,52,55,ward,53.5,abc patient2 01jan2010-25sep2010,0,25,hospital,, patient2 01jan2010-25sep2010,25,45,home,, patient2 01jan2010-25sep2010,45,46,ward,, ; proc sgplot data=highlow; highlow y=patient low=low high=high / type=bar group=type; text y=patient x=labelPoint text=labelValue / position=center; yaxis type=discrete fitpolicy=splitalways; run;
06-29-2017 10:59 AM
i try to put the legend in top of the graph and one line with this sentence:
keylegend / position=top down=1;
But now i have Patient with different type and still on two rows for legends.
Can you help me?
06-29-2017 11:41 AM
Add the NAME= option to your plot statements, then in the KEYLEGEND statement you can say for which plot statements you would like to have a legend.
proc sgplot data=highlow; highlow y=patient low=low high=high / type=bar group=type name="hl"; text y=patient x=labelPoint text=labelValue / position=center name="txt"; yaxis type=discrete fitpolicy=splitalways; keylegend "hl" / position=top down=1 ; run;
The placement might have something to do with space that is available, try to make your graph bigger.
Need further help from the community? Please ask a new question.