BookmarkSubscribeRSS Feed
Lapis Lazuli | Level 10

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.


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) 
	refline col7  /axis=y lineattrs=(color=red) name = "line1" legendlabel = "Mean X-response";
    keylegend "line" "line1" / location=inside position=topright across=1 noborder;


Do any options for refline exist to modify it?


Thank you!

Diamond | Level 26 RW9
Diamond | Level 26

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.

Lapis Lazuli | Level 10
The matter is that the timepoint "72 hours" exists with <null> value of concentration.
Diamond | Level 26 RW9
Diamond | Level 26

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

@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.


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
  • 4 replies
  • 3 in conversation