Data visualization with SAS programming

Annotating in Proc Sgpannel Output

Accepted Solution Solved
Reply
Super Contributor
Posts: 276
Accepted Solution

Annotating in Proc Sgpannel Output

[ Edited ]

Dear All,

 

I am trying to produce figure of Duration of AE for each subject.for this i have to producre the figrue in below layout

 

fig.png

 

For this i have tried with Proc SGpannel.I have almost got the layout what i am looking for(as show above),but i need to draw a line for each point based on the stating and ending days of the each subjid.I have passed the annotated dataset for drawing the lines for each point,but not not succeded to get the desire result.

 

I am provding sample data and the code which i have tried.


Data data;
input subjid trtgrp $ aeout $11. start_day end_day aetoxcd subseq;
cards;
12  1  Resolved   143 143 1 1 
27  1  Unresolved 255 256 1 2
143 1  Resolved   252 252 3 3
252 1  Resolved   392 395 1 4
417 1  Resolved   313 314 1 5
435 1  Resolved   428 435 1 6
443 1  Withdrwn   335 341 2 7
41  2  Resolved   170 171 1 1
55  2  Resolved   316 317 1 2
91  2  Withdrwn   432 432 2 3
133 2  Resolved   432 434 1 4
137 2  Resolved   369 370 1 5
141 3  Unresolved 393 428 1 1
144 3  Withdrwn   372 373 3 2
152 3  Resolved   141 142 1 3
154 3  Resolved   419 421 1 4
161 3  Resolved   304 305 1 5
;
run;

goptions  reset = all ftext = swiss htitle = 5 htext = 3 gunit = pct 
border cback = white hsize = 4in vsize = 4in;

data annotate;
set data;
 length function style color $8;
 retain xsys ysys hsys '3';
 function='move'; x=start_day  ; y=subseq; output;
 function='draw'; color=black; line=1; size=1; x=end_day  ; y=subseq; output;
 run; 
 


 proc sgpanel data=data sganno=annotate;
  panelby aetoxcd trtgrp / columns=1 spacing=5 novarname;
 scatter X=end_day Y=subseq/group=aeout;
run;

req.jpg

I am getting above output but without line.So i need to draw a line based on the statr_day and end_day.

 

Could you please provied any solution for this.If you can provied any eample code,that would be greatefull.

 

Thanks in Advace.

 

Thanks in Advance,

Sanjeev.K

 

 


Accepted Solutions
Solution
‎10-17-2015 11:19 AM
Respected Advisor
Posts: 4,606

Re: Annotating in Proc Sgpannel Output

Try playing with this:

 


data haveGraph;
set have;
panel = catx(" ", aetoxcd, trtgrp);
run;

proc sgpanel data=haveGraph;
panelby panel / columns=1 onepanel novarname;
highlow y=subseq low=start_day high=end_day / type=bar barwidth=0.1 nooutline;
scatter X=end_day Y=subseq / group=aeout;
run;
PG

View solution in original post


All Replies
Solution
‎10-17-2015 11:19 AM
Respected Advisor
Posts: 4,606

Re: Annotating in Proc Sgpannel Output

Try playing with this:

 


data haveGraph;
set have;
panel = catx(" ", aetoxcd, trtgrp);
run;

proc sgpanel data=haveGraph;
panelby panel / columns=1 onepanel novarname;
highlow y=subseq low=start_day high=end_day / type=bar barwidth=0.1 nooutline;
scatter X=end_day Y=subseq / group=aeout;
run;
PG
SAS Super FREQ
Posts: 1,044

Re: Annotating in Proc Sgpannel Output

You are mixing the annotation features between GPLOT and SGPLOT.  SGPLOT or SGPANEL support annotation using the SGAnnotation format.  Please see the doc for that.  Also note, for SGPANEL, annotation can only be done on the whole graph, not per cell.  Here is a recent paper:

https://support.sas.com/resources/papers/proceedings11/277-2011.pdf

 

Post a Question
Discussion Stats
  • 2 replies
  • 293 views
  • 1 like
  • 3 in conversation