BookmarkSubscribeRSS Feed
Nobody
Calcite | Level 5
I have a ReferenceLine statement within a layout prototype that is within a layout DataLattice. The CurveLabel prints several times across the graph, once for every change in the ColumnVar variable value. Is there a way to get the CurveLabel to print only once, say for either the maximum or minimum value of ColumnVar?
4 REPLIES 4
DanH_sas
SAS Super FREQ
If I'm understanding this scenario correctly, you should be able to duplicate the ColumnVar column, put missing values where you do not want values displayed, and point the ReferenceLine statement at column. Let me know if that works for you.

Thanks!
Dan
Nobody
Calcite | Level 5
Would your method work for a horizontal reference line? Here is a rough outline of my code;

layout gridded / rowgutter=5 border=false ;
layout datalattice columnvar=cohortc / ...
layout prototype / wallDisplay=(fill) ;
BarChart x=xlbl y=_Mean1_yvar_ / group=weekc ;
ScatterPlot X=xlbl Y=_Mean1_yvar_ / ;
ReferenceLine y=3.7 / clip=true curvelabel='XXX' ;
endlayout ;
endlayout ;
endlayout ;

If ReferenceLine takes either x= or y= as input (but not both) I am not clear how I can point it at and still get a horizontal reference line.
DanH_sas
SAS Super FREQ
Reference lines can specified directly (as in your case) or by a column. The column-driven technique enables you to create different reference lines in each cell. You can use the same techinque to control your labels. First, add your reference value and one label to your data. Here is one way to do it:

[pre]
proc sort data=sashelp.class out=temp; by sex; run;

data withref;
set temp;
by sex;
if first.sex then do;
refval = 3.7;
if (_n_ = 1) then reflabel="mylabel";
else reflabel=.;
end;
else do;
refval=.;
reflabel=.;
end;
run;
[/pre]

Then, change your REFERENCELINE statement to point to those columns:

ReferenceLine y=refval / clip=true curvelabel=reflabel ;

Give that a try and let me know if you get the result you want;

Thanks!
Dan
Nobody
Calcite | Level 5
Thank you very much Dan. That solution was so easy I'm embarrassed that I even had to ask. I need to read the documentation more closely.

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
  • 4 replies
  • 1410 views
  • 0 likes
  • 2 in conversation