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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 1073 views
  • 0 likes
  • 2 in conversation