BookmarkSubscribeRSS Feed
jojo
Obsidian | Level 7
I tried to use thee following code to add two reference lines in thee plot, why the label for second line doesn't show in the plot?
 
 
proc sgplot data=indata;
series x=visit y=result/group=usubjid datalabelattrs=(size=12pt) markers markerattrs=(size=12pt symbol=trianglefilled)
lineattrs=(thickness=3 pattern=solid) name="series_name";
keylegend "series_name" / valueattrs=(size=14);
refline 0 / axis=y lineattrs=(thickness=3 pattern=dash) label=("Upper Level of Healthy");
refline LLOQn / axis=y lineattrs=(thickness=3 pattern=dash) label=("LLOQ") labelloc=inside;
 
xaxis label="Visit" labelattrs=(size=16pt) VALUEATTRS=(Size=12
        Weight=Bold);
yaxis label="sample data" labelattrs=(size=16pt) VALUEATTRS=( Size=12
         Weight=Bold);
run;
2 REPLIES 2
ballardw
Super User

You may have to provide actual data to diagnose this. What does your LOG show when you run this code? Copy the text from the log window of the code and all the notes or other messages and paste the result into a text box opened on the forum with the </> icon that appears above the message window. The text box preserves diagnostic messages better than the main message window which will reformat pasted text and remove spaces and possibly replace characters.

 

Question: What is the value(s) for the variable LLOQN and the maximum and minimum of the variable Result?

Quentin
Super User

I ran this similar code:

proc sgplot data=sashelp.class;
  series x=height y=weight;
  refline 0 / axis=y lineattrs=(thickness=3 pattern=dash) label=("Upper Level of Healthy") noclip;
  refline age / axis=y lineattrs=(thickness=3 pattern=dash) label=("LLOQ") labelloc=inside noclip;
run;

And there is a NOTE in the log explaining why the label for the second refline statement is not created:

NOTE: CURVELABEL='LLOQ' is invalid. The option value cannot be a string when a column of reference lines is plotted. The label
      will not be drawn.

When you specify the refline as a variable, it suggests that you want to create mutiple reference lines, one for each value in the variable.  It wouldn't make sense to apply one label, "LLOQ" to multiple reference lines. When you use refline variable, SGPLOT expects you to use label=variable, not label="text string".

 

So this code "works":

proc sgplot data=sashelp.class;
  series x=height y=weight;
  refline 0 / axis=y lineattrs=(thickness=3 pattern=dash) label=("Upper Level of Healthy") noclip;
  refline age / axis=y lineattrs=(thickness=3 pattern=dash) label=name labelloc=inside noclip;
run;

(The plot is nonsensical and the labels collide, but they are printed.)

 

The Boston Area SAS Users Group is hosting free webinars!
Next webinar will be in January 2025. Until then, check out our archives: https://www.basug.org/videos. And be sure to subscribe to our our email list.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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