BookmarkSubscribeRSS Feed
_Hopper
Obsidian | Level 7

I have a series plot with error bars (series + highlow) where I had to add or subtract from the x axis values to separate the points. When I added the xaxis table to the plot, those values are also offset (I do not want this). I introduced a second hidden series plot using an X2 axis with the original values and tied the xaxis table to the X2 axis, but it didn't work. What am I missing?

 

Current code with the second series plot as described above:

 

proc sgplot data=stats2 dattrmap=myattrmap ;
where param = "&&param&i";
highlow x=month low=llim high=ulim / group=eyefl attrid=eyefl
highcap=serif lowcap=serif lineattrs = (thickness = 2) ;
series x = month2 y = mean/lineattrs=(thickness = 0) markerattrs = (size = 0);
series x=month y=mean/LINEATTRS= (THICKNESS= 2 ) group = EYEFL markers markerattrs = (size =7pt) grouporder = data name = 'Key' attrid = eyefl ;
series x = month2 y = mean/ name = 'Key 2' lineattrs = (thickness = 0) markerattrs = (size = 0pt);
yaxis values = (-10 to 10 by 1) grid valueattrs = (size = 7pt) labelattrs = (size = 7pt) label = 'Change from Baseline (dB)';
xaxis values = (0 to 3 by 1) offsetmin = 0.03 offsetmax = 0.03 valueattrs = (size = 7pt) labelattrs = (size = 7pt) label = 'Month';
Keylegend 'Key' /VALUEATTRS=(size=7pt family = 'Courier New') across = 6;
xaxistable n/class = eyefl valueattrs = (size = 7pt) labelattrs = (size = 7pt) labelpos = left x2axis x = month2;

run;

5 REPLIES 5
ballardw
Super User

I would say you are missing two data sets and two macro variable values to test your code.

 

Or as an absolute minimum a resulting graph and a clear description of what you expect. It is very hard to tell exactly which values are "also offset" .

 

 

_Hopper
Obsidian | Level 7
1. I cannot give you the data. It is not for the public domain.
2. The macro variable is a series of parameters the graph program rotates. Also not needed to solve the issue.
3. The offset values are on the x axis hence my query regarding the x axis table (the month variable). I am adding and subtracting certain amounts from the x values to separate the points. However, for the table, I do not want the values offset, hence the month2 variable.
ballardw
Super User

@_Hopper wrote:
1. I cannot give you the data. It is not for the public domain.


Make a dummy data set with non-sensitive values that behaves the same.

I wouldn't even make an attempt without the attribute data set as a lot of stuff can be buried in there.

Not to mention if there are any custom formats involved for your variables and values appearing the attribute set.

 


@_Hopper wrote:

2. The macro variable is a series of parameters the graph program rotates. Also not needed to solve the issue.


If code includes a WHERE statement must be able to test that. If you provide a single use case then we can drop the where.

 

I am way too lazy to attempt to create a data set and an attribute data set that may or may not show the same behavior.

DanH_sas
SAS Super FREQ

Instead of changing the X values to get spacing, what happens if you use GROUPDISPLAY=CLUSTER on the HIGHLOW and SERIES, and CLASSDISPLAY=cluster on the XAXISTABLE? You should be able to leave the axis table assigned to the X axis in that case.

 

Hope this helps!

_Hopper
Obsidian | Level 7
Hi Dan,

I tried those options but without the x-axis adjustment the error bars for the groups all overlap.

sas-innovate-white.png

Missed SAS Innovate in Orlando?

Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.

 

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
  • 5 replies
  • 1010 views
  • 0 likes
  • 3 in conversation