Raw data should look like in this example this:
data raw;
subjID+1;
input day0 day30 day60 day120;
cards;
0 2 3 4
0 2 3 4
0 2 3 4
2 1 2 4
2 1 2 4
2 1 2 4
2 1 2 4
2 1 2 4
2 1 4 3
4 3 2 1
4 3 2 1
4 3 2 1
4 3 2 1
;
run;
Basically each row (each subjid) indicates which drug was taken by a given patient during given time, e.g.
If patient 1 took drug 0 on the day 0, then drug 2 on the day 30, drug 3 on the day 60 and drug4 on day 120, the observation will be:
data raw;
input subjID day0 day30 day60 day120;
cards;
1 0 2 3 4
;
run;
Result of the following snippet:
proc format;
value domainf
1="day0"
2="day30"
3="day60"
4="day120";
value nodef
0="Drug A"
1="Drug B"
2="Drug C"
3="Drug D"
4="Drug E"
;
run;
data raw;
subjID+1;
input day0 day30 day60 day120;
format day0 day30 day60 day120 nodef.;
cards;
0 2 3 4
0 2 3 4
0 2 3 4
2 1 2 4
2 1 2 4
2 1 2 4
2 1 2 4
2 1 2 4
2 1 4 3
4 3 2 1
4 3 2 1
4 3 2 1
4 3 2 1
;
run;
ods graphics / height=15cm width=20cm imagefmt=svg imagename="sankey_basic" noborder;
ods listing gpath="R:\";
ods html;
%sankey(
data=raw,
domain=day0 day30 day60 day120,
domainfmt=domainf
);
looks like this:
Bart
... View more