Data visualization with SAS programming

Is REFERENCELINE valid with PROC SGRENDER?

Accepted Solution Solved
Reply
Contributor VCM
Contributor
Posts: 21
Accepted Solution

Is REFERENCELINE valid with PROC SGRENDER?

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


Accepted Solutions
Solution
‎02-05-2018 10:54 AM
SAS Super FREQ
Posts: 496

Re: Is REFERENCELINE valid with PROC SGRENDER?

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


All Replies
SAS Super FREQ
Posts: 1,265

Re: Is REFERENCELINE valid with PROC SGRENDER?

Use the LINEPARM statement.

Contributor VCM
Contributor
Posts: 21

Re: Is REFERENCELINE valid with PROC SGRENDER?

Posted in reply to Sanjay_SAS
Brilliant, worked perfectly! Thank you so much! Smiley Happy
Solution
‎02-05-2018 10:54 AM
SAS Super FREQ
Posts: 496

Re: Is REFERENCELINE valid with PROC SGRENDER?

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;
Contributor VCM
Contributor
Posts: 21

Re: Is REFERENCELINE valid with PROC SGRENDER?

Posted in reply to WarrenKuhfeld
That was the ticket, thank you so much! Smiley Happy
Super User
Posts: 13,084

Re: Is REFERENCELINE valid with PROC SGRENDER?

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.

 

☑ This topic is solved.

Need further help from the community? Please ask a new question.

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