BookmarkSubscribeRSS Feed
jsbyxws
Obsidian | Level 7

Hi, I have a Highlow plot for AEDECOD in term of study days for AE (AESTDY). I also want to add different treatment periods as a background using Block plot. After reading Sanjay's "The Block Plot" (https://blogs.sas.com/content/graphicallyspeaking/2014/04/14/the-block-plot/) I still did not know how to make it work. (1) I did not merge both datasets, instead I set them. (2) since EX did have periods without any treatment, I did not know how to reflect it. For example, dose 225ug starts day 1 and ends day 67. Next dose 75ug actually starts day 88. Ideally I would like day 68 to 87 to be blank in the graph. But current code did not do that.

 

Below is the code. Thanks a lot for help!

 

data ae;
	length USUBJID AEDECOD $200;
	USUBJID='subj1';
	AEDECOD='Nasopharyngitis';aestdy=18;aeendy=26;output;
	AEDECOD='Sinusitis';aestdy=90;aeendy=105;output;
	AEDECOD='Headache';aestdy=176;aeendy=178;output;
run;

data ex;
	length USUBJID dose $200;
	USUBJID='subj1';
	dose='225ug';exstdy=1;exendy=67;output;
	dose='75ug';exstdy=88;exendy=148;output;	
	dose='225ug';exstdy=175;exendy=177;output;		
run;

proc sort data=ae;by USUBJID aestdy;run;
proc sort data=ex;by USUBJID exstdy;run;
data ae_ex; set ae ex; run; proc sgplot data=ae_ex; block x=exstdy block=dose/name='EX' transparency=0.5 /* valueHalign=center valueValign=top */ /* FillType=alternate AltFillAttrs=(transparency=1)*/ ; highlow y=AEDECOD high=aeendy low=aestdy/type=bar barwidth=0.8 fillattrs=(color=yellow); yaxis grid display=(noticks nolabel) valueattrs=(color=gray size=10pt) ; xaxis grid label="Study Days" labelattrs=(color=black size=10pt) valueattrs=(color=gray size=10pt) offsetmax=0.02 values=(-10 to 190) ; run;
3 REPLIES 3
ChrisNZ
Tourmaline | Level 20

Like this?

data EX;
	length USUBJID DOSE $200;
	USUBJID='subj1';
	DOSE='225ug';EXSTDY=  1;EXENDY= 67;output;
	DOSE='N/A  ';EXSTDY= 67;EXENDY= 88;output;
	DOSE='75ug ';EXSTDY= 88;EXENDY=148;output;	
	DOSE='N/A  ';EXSTDY=148;EXENDY=175;output;
	DOSE='225ug';EXSTDY=175;EXENDY=177;output;		
run;

...

proc sgplot data=AE_EX;
	block  x=EXSTDY block=DOSE/name='EX' transparency=0.5 filltype=alternatelternate ;
	highlow y=AEDECOD high=AEENDY low=AESTDY/type=bar barwidth=0.8 fillattrs=(color=yellow);
	yaxis grid display=(noticks nolabel)  valueattrs=(color=gray size=10pt)	;
	xaxis grid label="Study Days" 
		  labelattrs=(color=black size=10pt)
		  valueattrs=(color=gray size=10pt) 
		  offsetmax=0.02 values=(0 to 190 by 10)
	      ;		
run;
 
 

image.png

 

 

jsbyxws
Obsidian | Level 7

Hi ChrisNZ,

 

Thanks a lot for help! Yes, I think this worked. In addition, I will add EXSTDY=0 and EXSTDY=178 with TRTA='N/A' so that both start and end are 'N/A'.

 

BTW, is there any way to assign colors for TRTA? For example, white for N/A, green for 25ug, blue for 75ug, red for 225ug? It puzzled me since BLOCK plot did not seem to have a group= option.

ChrisNZ
Tourmaline | Level 20

> is there any way to assign colors for TRTA?

You need to change the colours of GraphData1 - GraphDatan.

See here https://support.sas.com/rnd/datavisualization/gtl/concepts_sect5.htm

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 25. 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
  • 765 views
  • 0 likes
  • 2 in conversation