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

I was trying to use this code as reference: https://communities.sas.com/t5/Graphics-Programming/How-Can-I-Display-Confidence-Interval-like-Predi...

However, the 95% CI of my graph display overlaps the data points. I want either the background color of the 95% CI very faded or nonexistent.

 

%macro Graphics2(tissue=, units=, DV=, adjust=, pval=);
	title; title1; footnote1; footnote2;
	ods graphics / reset width = 300px height = 400px noscale attrpriority = none;
	
     proc sgplot data = work (where = (SPECTYPE = "&tissue"));
	 scatter x = V1WT y = &DV;
	 reg x = V1WT y = &DV / name = "reg" clm clmattrs=(clmfillattrs=(color=white) clmlineattrs=(pattern=shortdash)) nolegclm 
							nomarkers lineattrs = GraphData2; /*add regression line*/
	 keylegend "reg";
	 xaxis label = "Weight (kg)" values = (45, 50 to 200 by 25);
	 %if &adjust = Y %then %do;
	 yaxis label = "Concentrations (&units)";
		 title height = 10pt "Concentrations vs. Weight";
		 footnote1 j = l height = 8pt "Note: Concentrations were adjusted for dose received at time of sample taken";
	 %end;
	 %else %if &adjust = N %then %do;
		 yaxis label = "Concentrations (&units)";
		 title height = 10pt "&tissue: Concentrations vs. Weight";
	 %end;
	 inset ("p-value" = "&pval") / border textattrs = (size=8);
	run;
%mend;

%Graphics2(tissue= ADIPOSE TISSUE, units= ng/g, DV= ADJDV, adjust= Y, pval= 0.05);

mariko5797_0-1630083005311.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

@mariko5797 wrote:

I was trying to use this code as reference: https://communities.sas.com/t5/Graphics-Programming/How-Can-I-Display-Confidence-Interval-like-Predi...

However, the 95% CI of my graph display overlaps the data points. I want either the background color of the 95% CI very faded or nonexistent.

 

%macro Graphics2(tissue=, units=, DV=, adjust=, pval=);
	title; title1; footnote1; footnote2;
	ods graphics / reset width = 300px height = 400px noscale attrpriority = none;
	
     proc sgplot data = work (where = (SPECTYPE = "&tissue"));
	 scatter x = V1WT y = &DV;
	 reg x = V1WT y = &DV / name = "reg" clm clmattrs=(clmfillattrs=(color=white) clmlineattrs=(pattern=shortdash)) nolegclm 
							nomarkers lineattrs = GraphData2; /*add regression line*/
	 keylegend "reg";
	 xaxis label = "Weight (kg)" values = (45, 50 to 200 by 25);
	 %if &adjust = Y %then %do;
	 yaxis label = "Concentrations (&units)";
		 title height = 10pt "Concentrations vs. Weight";
		 footnote1 j = l height = 8pt "Note: Concentrations were adjusted for dose received at time of sample taken";
	 %end;
	 %else %if &adjust = N %then %do;
		 yaxis label = "Concentrations (&units)";
		 title height = 10pt "&tissue: Concentrations vs. Weight";
	 %end;
	 inset ("p-value" = "&pval") / border textattrs = (size=8);
	run;
%mend;

%Graphics2(tissue= ADIPOSE TISSUE, units= ng/g, DV= AD

 


Easiest thing to do would be the change the order of the Scatter and Reg plots. If you place the Scatter after the Reg it will be placed after (or over if you want to think of it that way) the regression.

Second would be to use the CLMTRANSPARENCY option with a value of 0.5 or greater (up to 1 for completely transparent). The default is 0 for this parameter which makes the confidence band opaque.

View solution in original post

1 REPLY 1
ballardw
Super User

@mariko5797 wrote:

I was trying to use this code as reference: https://communities.sas.com/t5/Graphics-Programming/How-Can-I-Display-Confidence-Interval-like-Predi...

However, the 95% CI of my graph display overlaps the data points. I want either the background color of the 95% CI very faded or nonexistent.

 

%macro Graphics2(tissue=, units=, DV=, adjust=, pval=);
	title; title1; footnote1; footnote2;
	ods graphics / reset width = 300px height = 400px noscale attrpriority = none;
	
     proc sgplot data = work (where = (SPECTYPE = "&tissue"));
	 scatter x = V1WT y = &DV;
	 reg x = V1WT y = &DV / name = "reg" clm clmattrs=(clmfillattrs=(color=white) clmlineattrs=(pattern=shortdash)) nolegclm 
							nomarkers lineattrs = GraphData2; /*add regression line*/
	 keylegend "reg";
	 xaxis label = "Weight (kg)" values = (45, 50 to 200 by 25);
	 %if &adjust = Y %then %do;
	 yaxis label = "Concentrations (&units)";
		 title height = 10pt "Concentrations vs. Weight";
		 footnote1 j = l height = 8pt "Note: Concentrations were adjusted for dose received at time of sample taken";
	 %end;
	 %else %if &adjust = N %then %do;
		 yaxis label = "Concentrations (&units)";
		 title height = 10pt "&tissue: Concentrations vs. Weight";
	 %end;
	 inset ("p-value" = "&pval") / border textattrs = (size=8);
	run;
%mend;

%Graphics2(tissue= ADIPOSE TISSUE, units= ng/g, DV= AD

 


Easiest thing to do would be the change the order of the Scatter and Reg plots. If you place the Scatter after the Reg it will be placed after (or over if you want to think of it that way) the regression.

Second would be to use the CLMTRANSPARENCY option with a value of 0.5 or greater (up to 1 for completely transparent). The default is 0 for this parameter which makes the confidence band opaque.

sas-innovate-2024.png

📢

ANNOUNCEMENT

The early bird rate has been extended! Register by March 18 for just $695 - $100 off the standard rate.

 

Check out the agenda and get ready for a jam-packed event featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events. 

 

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.

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
  • 1 reply
  • 1308 views
  • 0 likes
  • 2 in conversation