Hi @sas_user
Just a question:
in your sample date, the mean variable does not correspond to the mean of aval for a subjid in a specific treatment group (trtan) at a specific time point (atptn). Is it normal? How is the 'mean' calculated?
If it is a mistake maybe you could try the following:
proc sql;
create table pc3 as
select a.*, b.mean_atpt_overall
from
(select *, mean(aval) as mean_atpt_usbjid
from pc2
group by trtan, atpt ,subjid) as a
inner join
(select *, mean(aval) as mean_atpt_overall
from pc2
group by trtan, atpt) as b
on a.subjid=b.subjid and a.aval=b.aval and a.atptn=b.atptn and a.trta=b.trta
order by trtan, atptn, subjid;
run;
%macro plot (trtan);
proc sgplot data = pc3 /*dattrmap = anno*/ pad = (bottom = 20%) NOAUTOLEGEND ;
where trtan=&trtan.;
series x = atptn y = mean_atpt_usbjid / group=subjid
lineattrs = (color = black thickness = 1 pattern = solid);
series x = atptn y = mean_atpt_overall / attrid=trtcolor
lineattrs = (thickness = 2 pattern = solid);
title "Treatment = &trtan."; /*To be adapted*/
xaxis label= "Actual Time (h)"
labelattrs = (size = 10)
values = (0 12 24 36 48 72 96 120 168)
valueattrs = (size = 10)
grid;
yaxis label= "Plasma Concentration (ng/mL)"
labelattrs = (size = 10)
valueattrs = (size = 10)
grid;
run;
%mend;
%plot (1)
%plot (2)
Best,
... View more