BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
VCM
Obsidian | Level 7 VCM
Obsidian | Level 7

I have a scatterplot that needs a diagonal reference line (from 1,1 to MAXx,MAXy).  

 

My proc template:

 

proc template;
define statgraph XXXX;
begingraph ;

layout overlay / 
xaxisopts = (label='x-axis label' labelattrs=(family="Courier New" size=8pt weight=bold) tickvalueattrs=(family="Courier New" size=8pt weight=bold) linearopts = (tickvaluesequence = (start = 1 end = 10 increment = 1) 
viewmin = 1 viewmax = 10))
yaxisopts = (label="y-axis label" tickvalueattrs=(family="Courier New" size=8pt weight=bold) linearopts = (tickvaluesequence = (start = -10 end = 15 increment = 5) viewmin = -10 viewmax = 15));

entry halign=left ' ' / valign=top
textattrs=(family="Courier New" size=8pt weight=bold);
 
scatterplot x = pwk1 y = awk1 / markerattrs = (color=red symbol=circlefilled size=5) name="trt1" legendlabel="Avelumab";
scatterplot x = pwk2 y = awk2 / markerattrs = (color=blue symbol=circlefilled size=5) name="trt2" legendlabel="Avelumab + PLD";
scatterplot x = pwk3 y = awk3 / markerattrs = (color=green symbol=circlefilled size=5) name="trt3" legendlabel="PLD";

discretelegend "trt1" "trt2" "trt3"/ across=1 valueattrs=(family="Courier New" size=8pt weight=bold) valign=bottom halign=center location=outside;   endlayout; endgraph; end; run;

proc sgrender data=final template = xxxx;
run;
quit;

 

Can I use REFERENCELINE?  I've tried, but not sure if I'm not doing it correctly, or if it's not possible to use this statement. 

 

 

Thanks!

VCM

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenKuhfeld
Rhodochrosite | Level 12

I have used lineparm when I need a diagonal reference line.  Example:

  define statgraph Stat.MDS.Graphics.Fit;
      notes "MDS Fit Plot";
      dynamic head;
      begingraph / designwidth=defaultdesignheight;
         entrytitle head;
         layout overlayequated / equatetype=square ;
            scatterplot y = FitData x = FitDist / markerattrs=(size=5px);
            lineparm slope=1 x=0 y=0 / clip=true extend=true lineattrs=graphReference;
            endlayout;
         dynamic _byline_ _bytitle_ _byfootnote_;
         if (_bytitle_) entrytitle _byline_ / textattrs=GraphValueText;
         else if (_byfootnote_) entryfootnote halign=left _byline_;
         endif; endif;
         endgraph;
      end;

View solution in original post

5 REPLIES 5
Jay54
Meteorite | Level 14

Use the LINEPARM statement.

VCM
Obsidian | Level 7 VCM
Obsidian | Level 7
Brilliant, worked perfectly! Thank you so much! 🙂
WarrenKuhfeld
Rhodochrosite | Level 12

I have used lineparm when I need a diagonal reference line.  Example:

  define statgraph Stat.MDS.Graphics.Fit;
      notes "MDS Fit Plot";
      dynamic head;
      begingraph / designwidth=defaultdesignheight;
         entrytitle head;
         layout overlayequated / equatetype=square ;
            scatterplot y = FitData x = FitDist / markerattrs=(size=5px);
            lineparm slope=1 x=0 y=0 / clip=true extend=true lineattrs=graphReference;
            endlayout;
         dynamic _byline_ _bytitle_ _byfootnote_;
         if (_bytitle_) entrytitle _byline_ / textattrs=GraphValueText;
         else if (_byfootnote_) entryfootnote halign=left _byline_;
         endif; endif;
         endgraph;
      end;
VCM
Obsidian | Level 7 VCM
Obsidian | Level 7
That was the ticket, thank you so much! 🙂
ballardw
Super User

You should but it is a separate plot not part of scatterplot.

scatterplot x = pwk1 y = awk1 / markerattrs = (color=red symbol=circlefilled size=5) name="trt1" legendlabel="Avelumab";
scatterplot x = pwk2 y = awk2 / markerattrs = (color=blue symbol=circlefilled size=5) name="trt2" legendlabel="Avelumab + PLD";
scatterplot x = pwk3 y = awk3 / markerattrs = (color=green symbol=circlefilled size=5) name="trt3" legendlabel="PLD";

referenceline x= 5 / lineattrs=(thickness=3);

 

should place a vertical reference line at the value 5 on your horizontal axis (assuming 5 is in range) and would be a thickish line

 

If that does not work show the log.

 

SAS INNOVATE 2024

Innovate_SAS_Blue.png

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. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

Discussion stats
  • 5 replies
  • 1384 views
  • 0 likes
  • 4 in conversation