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

Hi Folks:

 

I'd like to highlight the part of the lines when corresponding p-values are statistically signifiant. Desired graph would have the line parts that are associated with 95% CI not inclusive of 1 bolded or bolded/dashed in a way that is more prominent than the line parts that are not significant. 

 

Any technical possibilities there and know how?

Your help is greatly appreciated.

Data attached.

 

SGPanel2.png

 


ods graphics/width=10in height=4in;
proc sgpanel data=p.PAR_PANC_FU;
panelby agegrp/ novarname columns=4 rows=1;
styleattrs DATACONTRASTCOLORS=(BLUE green red);
series  x=FU y=HazardRatio/group=stage lineattrs=(pattern=solid) LEGENDLABEL='HAZARD RATIO' lineattrs=(thickness=2);
keylegend/ title="Catgeories" position=TOP;
REFLINE 1 / LABEL = (' ') lineattrs=(color=black pattern=dash thickness=1.5); 
colaxis label='Weeks' min=1 max=100 grid values=(0 to 52 by 1);
rowaxis label='Hazar Ratio' 
fitpolicy=thin grid  values=(0.93 to 1.5 by 0.01);
/*INSET N PROBF/position=TOPRIGHT TEXTATTRS=(Color=BLUE Family=Arial Size=10)*/
title " ";
run;

data sig; set Par_panc_fu;
length one $8; 
if HRLowerCL>1 and HRUpperCL>1 then one='over'; else
if HRLowerCL<1 and HRUpperCL<1 then one='under'; else
one='non_sig';
run; 

proc print data=sig;
where one ne 'non_sig';
run; 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

I think it's something you can do yourself. And I can't download attachments so can't work with data or anything.

 

1. Create a new variable with only significant values notes (IF/THEN statement most likely)

2. Add a new series statement, referring to the new variable and specifying a thicker line. Not exactly sure how that will work with SGPANEL but should be fine.

 

It's one approach, there are likely others. 

View solution in original post

10 REPLIES 10
Reeza
Super User
Add an overlay of a band or a thicker line for parts that are significant.
Create a new variable that is the same as the graphed values but only present when the data is significant. Then graph that series using a bolder line structure or band so that it shows up more on the graph. It'll be overlaid so no issues otherwise.
Cruise
Ammonite | Level 13
Reeza, do you have time to show me in code?
Reeza
Super User

I think it's something you can do yourself. And I can't download attachments so can't work with data or anything.

 

1. Create a new variable with only significant values notes (IF/THEN statement most likely)

2. Add a new series statement, referring to the new variable and specifying a thicker line. Not exactly sure how that will work with SGPANEL but should be fine.

 

It's one approach, there are likely others. 

Cruise
Ammonite | Level 13

@Reeza 

Worked as shown below. Thank you!!!

worked.png



ods graphics/width=10in height=4in;
proc sgpanel data=p.sig;
panelby agegrp/ novarname columns=4 rows=1;
styleattrs DATACONTRASTCOLORS=(BLUE green red);
series  x=FU y=HazardRatio/group=stage lineattrs=(pattern=solid) LEGENDLABEL='HAZARD RATIO' lineattrs=(thickness=1);
series  x=FU y=one/group=stage lineattrs=(pattern=dash) lineattrs=(thickness=3);
keylegend/ title="Categories" position=TOP;
REFLINE 1 / LABEL = (' ') lineattrs=(color=black pattern=dash thickness=1.5); 
colaxis label='Weeks' min=1 max=100 grid values=(0 to 52 by 1);
rowaxis label='Hazard Ratio' 
fitpolicy=thin grid  values=(0.93 to 1.5 by 0.01);
INSET N PROBF/position=TOPRIGHT TEXTATTRS=(Color=BLUE Family=Arial Size=10)
BORDER;
title " ";
/*format stage stage. agegrp agegrp.; */
run;
Cruise
Ammonite | Level 13

@Reeza @ballardw 

 

Any idea how to get rid of the legend for the dashed lines ?

DanH_sas
SAS Super FREQ

Put a NAME= on the SERIES you want in the legend (e.g. NAME="mySeries"), and add the following statement to the proc:

 

keylegend "mySeries";

 

If you want a TITLE on it:

 

keylegend "mySeries" / title="My Group Title";

 

Hope that helps!

Dan

 

Cruise
Ammonite | Level 13

Great. Solved the problem. 

@DanH_sas 

 

SGPanel11.png

and the final code is following:

 

ods graphics/width=10in height=4in;
proc sgpanel data=p.sig;
panelby agegrp / novarname columns=4 rows=1 ;
styleattrs DATACONTRASTCOLORS=(BLUE green red);

series  x=FU y=HazardRatio/group=stage lineattrs=(pattern=solid) LEGENDLABEL='HAZARD RATIO' lineattrs=(thickness=1)
name="mySeries";
 
series  x=FU y=one/group=stage lineattrs=(pattern=dash) lineattrs=(thickness=3);

keylegend "mySeries"/ title="Categories" position=TOP;

REFLINE 1 / LABEL = (' ') lineattrs=(color=black pattern=dash thickness=1.5); 
colaxis label='Weeks ' min=1 max=100 grid values=(0 to 52 by 1);
rowaxis label='Hazard Ratio' 
fitpolicy=thin grid  values=(0.93 to 1.5 by 0.01);
INSET N PROBF/position=TOPRIGHT TEXTATTRS=(Color=BLUE Family=Arial Size=10)
BORDER;
title " ";
/*format stage stage. agegrp agegrp.; */
run;
Ksharp
Super User

How about this one ?

 

data air;
 set sashelp.air;
 year=year(date);
 group=(month(date)>5);
 if year in (1951 1952);
 run;
 
 proc print;run;
 
 ods graphics/attrpriority=none;
 proc sgpanel data=air;
 panelby year/rows=1 novarname;
 styleattrs datacontrastcolors=(green red) datalinepatterns=(dash solid) ;
 series x=date y=air/group=group;
 run;

x.png

Reeza
Super User
The OP's graph already includes a GROUP statement which means more data manipulation is required to handle that 😞
ballardw
Super User

@Cruise wrote:

@Reeza @ballardw 

 

Any idea how to get rid of the legend for the dashed lines ?


@DanH_sas already answered.

 

I did have the thought as I saw your result post, "Hmmm, I wonder if he's going to want to remove the dashes from the legend?".

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 10 replies
  • 1275 views
  • 12 likes
  • 5 in conversation