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

Hello. I believe that what I'm looking for isn't currently possible but I'm hoping that someone may have a workaround or other suggestion. I'm using V9.4 Level 1M1.

 

The attached figure is produced by SGPanel using the syntax below. The data are near-instantaneous measurements of the performance of a fish trawl, net dimensions, vessel speed, etc.

 

Mostly, the scales of the row (y) axes don't overlap so the refline(s) for each part of the figure appear to be independent of one another (i.e. blue for Net Width, Orange for Vessel Speed, etc.). However, for a couple of the parameters (Bottom Contact and Net Temp) the scales do overlap with other types of measurements and so the reflines appear on parts of the figure where I don't really want them to (e.g. the reflines for Door Width, Net Width, Net Height, and Vessel Speed all show on the figure for Bottom Contact). The reflines for each parameter represent the minimum, maximum, acceptable values and normal/expected value for each parameter.

 

So, my question... is there any way to suppress the reflines for parts of the figure or to otherwise fool the system into making them not-visible? Any suggestions appreciated.

 

Program statements:

ods graphics on / width = 9.00in height = 12.00in;
options nobyline;

proc sgpanel data = PlotNets01SRPanel noautolegend;
by Station;
panelby Measuretitle / columns=1 rows=7 uniscale=column novarname headerattrs=(weight = bold size = 10PT);
series x = Time y = valueActW / lineattrs = (pattern=1 color=blue thickness=2 PT) markers markerattrs = (color=blue size=10 PT);
series x = time y = ValueMinW / transparency=1;
series x = time y = ValueMaxW / transparency=1;
refline LwrW / axis=y lineattrs = (pattern=5 color = blue);
refline UprW / axis=y lineattrs = (pattern=5 color = blue);
refline NrmW / axis=y lineattrs = (pattern=2 color = blue);

series x = Time y = valueActH / lineattrs = (pattern=1 color=red thickness=2 PT) markers markerattrs = (color=red size=10 PT) ;
series x = time y = ValueMinH / transparency=1;
series x = time y = ValueMaxH / transparency=1;
refline LwrH / axis=y lineattrs = (pattern=5 color = red);
refline UprH / axis=y lineattrs = (pattern=5 color = red);
refline NrmH / axis=y lineattrs = (pattern=2 color = red);

series x = Time y = valueActS / lineattrs = (pattern=1 color=orange thickness=2 PT) markers markerattrs = (color=orange size=10 PT) ;
series x = time y = ValueMinS / transparency=1;
series x = time y = ValueMaxS / transparency=1;
refline LwrS / axis=y lineattrs = (pattern=5 color = orange);
refline UprS / axis=y lineattrs = (pattern=5 color = orange);
refline NrmS / axis=y lineattrs = (pattern=2 color = orange);

series x = Time y = valueActD / lineattrs = (pattern=1 color=green thickness=2 PT) markers markerattrs = (color=green size=10 PT);
series x = time y = ValueMinD / transparency=1;
series x = time y = ValueMaxD / transparency=1;
refline LwrD / axis=y lineattrs = (pattern=5 color = green);
refline UprD / axis=y lineattrs = (pattern=5 color = green);
refline NrmD / axis=y lineattrs = (pattern=2 color = green);

series x = Time y = valueActDp / lineattrs = (pattern=1 color=green thickness=2 PT) markers markerattrs = (color=green size=10 PT);
series x = time y = ValueMinDp / transparency=1;
series x = time y = ValueMaxDp / transparency=1;

series x = Time y = valueActT / lineattrs = (pattern=1 color=violet thickness=2 PT) markers markerattrs = (symbol=circle color=violet size=10 PT);
series x = time y = ValueMinT / transparency=1;
series x = time y = ValueMaxT / transparency=1;

series x = Time y = valueActB / lineattrs = (pattern=1 color=black thickness=2 PT) markers markerattrs = (symbol=circle color=black size=10 PT);
series x = time y = ValueMinB / transparency=1;
series x = time y = ValueMaxB / transparency=1;

title h=1.5 '#byval1';
run;

1 ACCEPTED SOLUTION

Accepted Solutions
DanH_sas
SAS Super FREQ

Without seeing your data processing, I would have to guess that you set the value for each of these reflines in your data step without considering the panelby variable value. This would make the reflines appear on any axis with that value (like you described). By including the panelby variable and match-merging, you isolate the reflines to each cell so you do not get the "bleed over" you saw.

View solution in original post

9 REPLIES 9
DanH_sas
SAS Super FREQ

Your picture did not get attached.

Bonzeus
Calcite | Level 5

Sorry... first time in 35 years as a sas programmer I've used this help system. Trying again.TrawlData.jpg

DanH_sas
SAS Super FREQ

The issue appears to be how you merged the refline data into your main data. Try these steps:

1. Put the refline in a separate dataset, using the same PANELBY variable (measuretitle) and the correct measure title for each refline value.

2. Match merge the refline data with the main data by measuretitle

3. Use the resulting dataset in sgpanel

 

This should create refline grouping that are unique to each each, regardless of data range. Let me know if this works for you.

 

Thanks!

Dan

Bonzeus
Calcite | Level 5

Thanks for the suggestion. I understand what you're saying though i must misunderstand how reline works in SGPanel. I thought that if you specify a refline at one particular y value that it would appear in whatever panel it would 'fit' according to the range of the y axis in that panel. I must be wrong about that. So thanks for clarifying. I'll give your suggestion a try.

DanH_sas
SAS Super FREQ

Without seeing your data processing, I would have to guess that you set the value for each of these reflines in your data step without considering the panelby variable value. This would make the reflines appear on any axis with that value (like you described). By including the panelby variable and match-merging, you isolate the reflines to each cell so you do not get the "bleed over" you saw.

Bonzeus
Calcite | Level 5
My reflines are actually hard-coded via macro variables in the upper parts of the program then assigned to regular SAS variables in the last data step before I plot, so yes they exist on every data line regardless of the panelby variable.

I learned something new today. Thanks much.
Reeza
Super User
Two approaches I can see. One is add some measure of variance or some detection method to determine when it can't be done and then just 0 or set those values to missing in those cases, so there's no value for the reflines. Another is to see if conditional formatting is available and in those cases set to to the same colour as the background color and then they'd pretty much disappear. These are high level approaches. Hopefully someone else can help with the exact code or it can help you get started.
Bonzeus
Calcite | Level 5

Thanks for the ideas. I'm going to try DanH's suggestion first and if that doesn't help I'll look more into yours.

 

Thanks again.

PGStats
Opal | Level 21

Since all your X axis are the same, you could make all the lines about a given parameter into groups, including the reflines. This would mean adding some observations to your dataset to draw the reflines.

 

group = "LOWER";

valueACTW = lwrw;

time = minTime; output; time = maxTime; output;

group = "UPPER";

valueACTW = uwrw;

time = minTime; output; time = maxTime; output;

 

and then

 

series x = Time y = valueActW / group=group ...;

 

but also using a discrete attribute map dataset to control the appearance of the groups (lines).

 

 

PG

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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