From: SAS_learner on
For a graph Change from Base line I need to put a number close to the bar
which shows the number of days from baseline to the best response. To put
them I am doing something like this. I do not like this solution at all as
this is hardcoding the vales for Cpn. I tried to generalize my approach in
the part2 I am getting values close to not way I want . Is there a better to
do it . If I am adjusting the values for Cpn the txt values at end of bars
are spreading all over the place.


/*Sorry for rather long code*/ ;
data b ;
Retain Cpn Cpn_1 13 Cpn_2 ;
set b (in = a);
If patient= '019-010' then cpn= Cpn-.5 ;
If patient= '009-025' then cpn= cpn +3;
If patient= '022-018' then cpn= cpn +5;
If patient= '019-022' then cpn= cpn +5.5;
If patient= '009-028' then cpn= cpn +3;
If patient= '009-008' then cpn= cpn +5;
If patient= '019-019' then cpn= cpn +5;
If patient= '009-023' then cpn= cpn +5;
If patient= '009-021' then cpn= cpn +5;
********************+++++++***********;
If patient= '009-027' then cpn= cpn +5;
If patient= '019-009' then cpn= cpn +5;
If patient= '009-024' then cpn= cpn +5;
If patient= '019-002' then cpn= cpn +4;
If patient= '022-014' then cpn= cpn +4;
********************+++++++***********;
If patient= '009-011' then cpn= cpn +5;
If patient= '022-007' then cpn= cpn +5;
If patient= '009-003' then cpn= cpn +5;
If patient= '009-016' then cpn= cpn +5;
If patient= '019-015' then cpn= cpn +5;
/***************Part2************************************
If _n_ =1 Then Cpn_2 = Cpn_1 ;
Else Cpn_2 = (Cpn_2+5) ;
Diff = Cpn - Cpn_2 ;
**************End of Part2*******************************/

if prtdiff ^= . Then yxc = abs(ceil(prtdiff))+5;
if prtdiff Lt 0 Then yxc = (Yxc-(-1))*-1;
if prtdiff Ge 0 Then yxc = Yxc;
Run;
data anno;
length function style color $8 text $20;
retain xsys '3' ysys '2' when 'a' style 'solid';
set b (in = a);
if a then do;
function='label'; x=cpn; y=yxc; text=dd; position='2';
* angle=45; xsys='3'; ysys='2'; size=1; when='a';
color='black';
end;
keep patient Subjid function x y text xsys ysys size when color yxc
cpn lesion prtdiff prt/*angle*/;
run;