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
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;
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.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.