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

Hi there,

I’m creating a plot (i.e. empirical density function) and I’m including a vertical line corresponding with a the cut-off value '&max' in the REFLINE statement (see code below).

Nevertheless, the actual value is not displayed at the bottom of the line. Can you please let me know how can I do that?

Thanks a lot,

A.G.

proc sgplot data=dat cycleattrs ;

    density &var/  LINEATTRS=(color=daolg)type=kernel(c=25)                      scale=density freq=&weight       legendlabel="prior";

 

xaxis label="&label" min= 0 max=&mx;

yaxis label='Empirical density function(EDF)';

 

*Inserting cut-off values as vertical lines;

refline &max / axis=x lineattrs=(thickness=3 color=darkred pattern=dash)

               label=("UL");

run;

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

You have not provided anything that might hold the value to the Label

 

If &max is a single value then add that to the Label ="UL &max"

 

If your &max is more than a single value then you need to describe things a bit better and may be better off adding some records to the data set with the values and having the variable containing the Refline values instead of a list, then use that or a variable build to hold the desired text in the Label= option.

View solution in original post

4 REPLIES 4
ballardw
Super User

You have not provided anything that might hold the value to the Label

 

If &max is a single value then add that to the Label ="UL &max"

 

If your &max is more than a single value then you need to describe things a bit better and may be better off adding some records to the data set with the values and having the variable containing the Refline values instead of a list, then use that or a variable build to hold the desired text in the Label= option.

alexgonzalez
Quartz | Level 8
Hi BallardW,
Thanks for your recommendation. &max is indeed a single value. I thought about that obtion, but I rather have the value displayed at the bottom of the X axis and at the top the label 'UL'.
Regards,
A.G.
ballardw
Super User

@alexgonzalez wrote:
Hi BallardW,
Thanks for your recommendation. &max is indeed a single value. I thought about that obtion, but I rather have the value displayed at the bottom of the X axis and at the top the label 'UL'.
Regards,
A.G.

As far as I know you only get one label position per refline. But I bet if you add a second Refline statement with the LABELPOS=max (this is a standard parameter NOT your macro variable) and Label="&max" that you get what you want.

You are drawing the same line twice with two different labels.

alexgonzalez
Quartz | Level 8
That worked perfectly.
Thanks again!

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 4 replies
  • 2282 views
  • 1 like
  • 2 in conversation