proc template; define style GDOLinePlotBW; parent=Styles.JOURNAL; class GraphError / LineThickness=1px; class GraphData1 / markersymbol = "CircleFilled" linestyle = 1; class GraphData2 / markersymbol = "Triangle" linestyle = 2; end; run;
SCATTERPLOT X=_jitter_time Y=y/ YERRORUPPER = uppervar YERRORLOWER = lowervar DATATRANSPARENCY = 0.3 NAME = 'scatter' GROUP = groupp;
Hi all,
Is there any problem with my code? Why the linetype is the same with two group?
Thanks.
Upon thinking about this further, I think the problem you have is because the error bars do not use the GraphData1 and GraphData2 elements, they use the GraphError element. I think I'll request @DanH_sas to weigh in. I do not know how to change the line of the error bars.
There is a workaround: Use the HIGHLOW statement instead of adding error bars to the SCATTER statement. I think this will solve your problem:
ods html style=GDOLinePlotBW;
ods graphics on / attrpriority=none;
data A;
do Group = 'A','B';
do xx = 1 to 2;
x = xx+0.1*(Group='A');
y = x; L = x-1; U=x+1;
output;
end;
end;
run;
proc sgplot data=A;
highlow x=x high=U low=L / group=Group;
scatter x=x y=x / group=Group;
run;
Make sure that ATTRPRIORITY=NONE attribute is set. That is the default for the Journal style, but if you override it then the line attributes will not change.
Try running this program in your style. Does it show different line patterns?
ods html style=GDOLinePlotBW;
ods graphics on / attrpriority=none;
proc sgplot data=sashelp.iris aspect=1;
reg x=petalwidth y=sepalwidth / group=species nomarkers;
run;
If not, please post your entire graphics program so we can what else you are setting.
Upon thinking about this further, I think the problem you have is because the error bars do not use the GraphData1 and GraphData2 elements, they use the GraphError element. I think I'll request @DanH_sas to weigh in. I do not know how to change the line of the error bars.
There is a workaround: Use the HIGHLOW statement instead of adding error bars to the SCATTER statement. I think this will solve your problem:
ods html style=GDOLinePlotBW;
ods graphics on / attrpriority=none;
data A;
do Group = 'A','B';
do xx = 1 to 2;
x = xx+0.1*(Group='A');
y = x; L = x-1; U=x+1;
output;
end;
end;
run;
proc sgplot data=A;
highlow x=x high=U low=L / group=Group;
scatter x=x y=x / group=Group;
run;
Yes, I finally chose highlow to solve this problem.
Thank you for your help!
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.
Ready to level-up your skills? Choose your own adventure.