Hi Reeza,
The solution worked however I still got one more problem when I try to display the slope. It is not showing the correct intercept value not sure what is the issue. this is the figure and the code that I'm trying
%macro create_graph(_paramn=, _param=, _avision=, _trta=, _usubjid=);
data _null_;
set example (obs=1);
where paramn=&_paramn. & param="&_param." & avision=&_avision. & trta="&_trta." & usubjid="&_usubjid.";
call symput('Int', put(intercept, BEST6.));
call symput('Slope', put(slope, BEST6.));
run;
title " &_param &_avision &_trta &_usubjid";
proc sgplot data=example noautolegend;
where paramn=&_paramn. & param="&_param." & avision=&_avision. & trta="&_trta." & usubjid="&_usubjid.";
scatter x=parcat3n y=value / group=trta groupdisplay=cluster clusterwidth=0.5
markerattrs=(size=10)errorbarattrs=(thickness=2);
styleattrs datasymbols=(circle);
yaxis label='Aval (D)' grid values=(-7.25 to 7.25 by 0.25);
xaxis offsetmax=0.08 fitpolicy=rotate values=(-0.41 -0.2 0 0.2 0.41 0.61 0.81
1.02 1.22 1.43 1.63 1.83 2.04 2.24 2.44 2.65 2.85 3.06 3.26);
refline x_axis_value / axis=x lineattrs=(color=red thickness=3px
pattern=ShortDashDot);
inset "Intercept = &Int" "Slope = &Slope" / border title="Parameter Estimates" position=topleft;
lineparm x=0 y=intercept slope=Slope;
keylegend / title="Treatment";
run;
%mend;
data test;
set example;
by paramn param avision trta usubjid NOTSORTED;
if first.usubjid then
do;
str=catt('%create_graph(_paramn=', paramn, ", _param=", param,
" , _avision=", avision, ", _trta= ", trta, ", _usubjid=", %str(usubjid),
');');
rc=dosubl(str);
output;
end;
run;
... View more