BookmarkSubscribeRSS Feed
lu_king
Fluorite | Level 6

Hi everybody! 

I have two questions. How do I can I change the labels of the y axis and x axis on my graph, and how do I put a legend in for p-value, correlation, 95 %confidence limits, etc? 

Here is my code. 

 

proc gplot data = Omni.Omi_citi_RNA;
plot D7_cases*D_RNA_cpL1000;
run;
symbol1 interpol=rcclm95
value=circle
cv=darkred
ci=black
co=blue
width=2;
plot D7_cases*D_RNA_cpL1000 / haxis=0.0 to 0.09 by 0.01
vaxis=0 to 150 by 10
hminor=1
regeqn;
run;
quit;

3 REPLIES 3
ballardw
Super User

If you are going to use Proc GPLOT then you use AXIS statements to define how an axis appears and point the plot to use the specific axis definition with options like haxis=axis3 (you can have 100 axis definitions active IIRC). The AXIS options allow you to define the tickmark values, tickmark labels, general label text and appearance.. LEGEND definitions to control the legend.

 

Are you expecting these value to be "automagic" from the procedure or you define the values? Without data and which specific value expect it is hard to guess what you need.

 

I might suggest moving to more modern procedures like SGPLOT as there are more plot types available and generally much more control available. If you can get the values of miscellaneous text like p-values or correlation as text plots or inlay statements depending on where the values may be needed. Confidence limits can come in a number flavors and might be available in the plot options.

 

An example that you should be able to run just to demonstrate a simple regression in SGPLOT

proc sgplot data=sashelp.class;
   reg x=height y=weight / 
              cli clm
   ;
   xaxis label='Height in inches' values =(50 to 80 by 10);
   yaxis label='Weight in pounds' values =( 0 to 150 by 25);
   inset "Some other text to place in the graph"; 

run;

Since p-value implies a statistical test you need to run the test and capture that value. Similar with correlations. The results might be added to the the plotted data set to display with a TEXT plot statement or into macro variables to use in an Inset.

lu_king
Fluorite | Level 6

Hello, 

Thanks for the help! This the graph I get when I run the original code.  

lu_king_0-1678731796324.png

I have tried the SGPLOT bot it's not exactly what I want. I'd like to rename the axis labels and add a legend to this type of plot. I am assuming the blue dotted lines are based off of 95% confidence limits. 

 

I might be asking for completely different things here, if so I apologize, working with this type of graph is a first for me!

ballardw
Super User

If you use Gplot then an AXIS statement with the LABEL= option. You will also need to include values and can modify tickmark appearance. You have not said anything about what the label text should be so can't do much more than that.

Legend is the same way, you provide the appearance and the text options for each piece you want shown.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 439 views
  • 0 likes
  • 2 in conversation