Hi,
I want to draw a simple quadrant graph in SAS. The example of the data is:
Hospital_name death_rate_2013 diff_compare_with_2015
AA1 1.2 -0.5
AA2 1.5 0.1
AA3 0.8 0
AA4 1.0 -0.4
AA5 1.9 0.4
AA6 1.4 0.1
AA7 0.5 -0.2
I want the horizontal axis be: Low death rate (on the left) and high death rate (on the right)
Vertical axis: Low reduction (bottom) and high reduction (top)
And in the graph to show where each hospital is placed. How can I do it?
Thanks
It sounds like you want a basic scatter plot with markers labeled by the hospital name:
data Have;
input Hospital_name $3. death_rate_2013 diff_compare_with_2015;
datalines;
AA1 1.2 -0.5
AA2 1.5 0.1
AA3 0.8 0
AA4 1.0 -0.4
AA5 1.9 0.4
AA6 1.4 0.1
AA7 0.5 -0.2
;
proc sgplot data=Have;
scatter x=death_rate_2013 y=diff_compare_with_2015 / datalabel=Hospital_name;
run;
For more about creating simple graphs in SAS, see the SGPLOT documentation. Click the link for the SCATTER statement to learn more about options that are available for scatter plots.
No. I would like something similar to the image from here:
http://www.prescientdigital.com/articles/intranet-articles/the-big-deal-about-portals
It is not clear what features of that graph are important, but try the following:
data Have;
input Hospital_name $3. death_rate_2013 diff_compare_with_2015;
datalines;
AA1 1.2 -0.5
AA2 1.5 0.1
AA3 0.8 0
AA4 1.0 -0.4
AA5 1.9 0.4
AA6 1.4 0.1
AA7 0.5 -0.2
;
proc means data=Have mean;
var death_rate_2013; /* use mean value for reference line */
run;
proc sgplot data=Have noborder;
text x=death_rate_2013 y=diff_compare_with_2015 text=Hospital_name;
refline 1.1857143 / axis=x; /* use mean value (?) */
refline 0 / axis=y;
xaxis display=(noline noticks novalues);
yaxis display=(noline noticks novalues);
run;
Thanks!
Just one more question. I would like to make more like this (would like to ut labels into the graph):
http://support.sas.com/kb/24/927.html
I'm assuming your talking about the quandrant labels. The easiest way for you to do that is to use INSET statements. To see how this would work, take the code Rick provided and add the following to the SGPLOT procedure:
inset "TopLeft" / position=topleft;
inset "Top" / position=top;
inset "TopRight" / position=topright;
inset "Right" / position=right;
inset "BottomRight" / position=bottomright;
inset "Bottom" / position=bottom;
inset "BottomLeft" / position=Bottomleft;
inset "Left" / position=left;
If you want the text split onto multiple lines, just break the text using multiple quoted strings:
inset "Bottom" "Right" / position=bottomright;
Hope this helps!
Dan
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: