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

 

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.

 

 

WeChat Image_20200623195742.png

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

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;

View solution in original post

3 REPLIES 3
Rick_SAS
SAS Super FREQ

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.

 

 

Rick_SAS
SAS Super FREQ

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;
Lee_wan
Obsidian | Level 7

Yes, I finally chose highlow to solve this problem.

Thank you for your help!

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 16. 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
  • 3 replies
  • 730 views
  • 0 likes
  • 2 in conversation