Data visualization with SAS programming

How modify Reference line in PROC SGPLOT

Reply
Regular Contributor
Posts: 210

How modify Reference line in PROC SGPLOT

Hi all,

 

Could you please help to modify Reference line on the graph below. The issue is the reference line extends beyond timepoints where values of  concentration do not exist.

1.jpg

The code that was used is here:

proc sgplot data=abc; 
  where col1 = "&&sub&i";
    styleattrs AXISBREAK=Bracket;
    series x=col3 y=col4/ lineattrs=(pattern=solid color=blue) name="line" markers markerattrs=(symbol=circlefilled color=blue size=6);
	xaxis label='Timepoint (hrs)' type=linear values = (0 to &&xmax&i. by 12)  
    integer valueattrs=(size=8pt) fitpolicy = rotate integer valuesrotate=vertical;
     yaxis label='Semi-log Concentration' 
     type=log logbase=10 logstyle=linear logvtype=expanded values = (0.1 1 10) 
        THRESHOLDMin=1 THRESHOLDMAX=1;
	refline col7  /axis=y lineattrs=(color=red) name = "line1" legendlabel = "Mean X-response";
    keylegend "line" "line1" / location=inside position=topright across=1 noborder;

run;

Do any options for refline exist to modify it?

 

Thank you!

Super User
Super User
Posts: 9,193

Re: How modify Reference line in PROC SGPLOT

Posted in reply to DmytroYermak

As far as I am aware the refline will fill across the width or height of the axis - it is a reference line at the end of the day.  What you could do is just overlay a series plot of x=0, y=col7 and x=60, y=col7.

Regular Contributor
Posts: 210

Re: How modify Reference line in PROC SGPLOT

The matter is that the timepoint "72 hours" exists with <null> value of concentration.
Super User
Super User
Posts: 9,193

Re: How modify Reference line in PROC SGPLOT

Posted in reply to DmytroYermak

Just add it to your where clause then:

  where col1 = "&&sub&i" and col4 ne .;

Also note, you don't need the macro looping - which I can infer from the &&sub&i, you can use by grouping:
 

Super User
Posts: 13,008

Re: How modify Reference line in PROC SGPLOT

Posted in reply to DmytroYermak

@DmytroYermak wrote:
The matter is that the timepoint "72 hours" exists with <null> value of concentration.

?????

I always get confused when people reference "null" in SAS discussions since SAS uses the term "missing".

 

And why no complaint about the reference line showing at x=0?

 

Old school solution would be create another plot series with matching x values that start and end with corresponding values of y with the refline value.

Of course if the refline is changing for each level of your macro variable that could lead to some mildly entertaining code.

Ask a Question
Discussion stats
  • 4 replies
  • 106 views
  • 0 likes
  • 3 in conversation