Data visualization with SAS programming

Plot time-vary drug exposure

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 7
Accepted Solution

Plot time-vary drug exposure

Because both the dose and duration of drug vary between subjects and within subjects over time

I use the time-depedent Cox regression to analyze it

However, how do I explain the consistence of drug use, that a user always a user or sometimes discontinue

I consider use of figure to explain how the dose and duration vary within individual, like the figure show as below

螢幕快照 2015-06-14 下午12.07.33.png

For example of my data and full data in the attached file. How do the sas plot the figure?  Thanks you very much

         

IDPrescribe dataDispense durationdosedate sequenceHeader 6
12000.1.1.7101

1

2000.1.15271514
12000.2.12142042
12000.2.27281557
12000.4.1281585
Attachment

Accepted Solutions
Solution
‎06-14-2015 09:32 PM
SAS Super FREQ
Posts: 1,139

Re: Plot time-vary drug exposure

ExposurePlot.png

ods graphics / reset attrpriority=color width=5in height=3in imagename='ExposurePlot';

title "Exposure by Subject Id and Date";

proc sgplot data=exposure2;

  label id='Subject id';

  label prescribe_date='Prescribe Date';

  label total_amt='Amount';

  step x=prescribe_date y=total_amt / group=id justify=right;

  keylegend / across=2 valueattrs=(size=7);

  yaxis grid;

  xaxis grid;

run;

View solution in original post


All Replies
SAS Super FREQ
Posts: 1,139

Re: Plot time-vary drug exposure

I am guessing on what you are asking.  Here is one solution using SAS 9.4 SGPANEL Procedure using your data.  I removed duplicates.  Code is shown below.

Exposure.png

data exposure;

  set zino.exposure;

  format prescribe_date date9.;

run;

proc sort data=Exposure out=Exposure2 nodupkey;

by id prescribe_date;

run;

ods graphics / reset width=5in height=6in imagename='Exposure';

title "Exposure by Subject Id and Date";

proc sgpanel data=exposure2;

label id='Subject id = ';

label prescribe_date='Prescribe Date';

label total_amt='Amount';

panelby id / layout=rowlattice rows=4 columns=1 onepanel noheader;

step x=prescribe_date y=total_amt / justify=right;

inset id / position=topleft textattrs=(size=10);

rowaxis offsetmax=0.2 grid;

colaxis grid;

run;

Occasional Contributor
Posts: 7

Re: Plot time-vary drug exposure

Thank you very much, It is what I want. Smiley Happy

Is it possible to put all individuals figure in one figure?   :smileyconfused:

Solution
‎06-14-2015 09:32 PM
SAS Super FREQ
Posts: 1,139

Re: Plot time-vary drug exposure

ExposurePlot.png

ods graphics / reset attrpriority=color width=5in height=3in imagename='ExposurePlot';

title "Exposure by Subject Id and Date";

proc sgplot data=exposure2;

  label id='Subject id';

  label prescribe_date='Prescribe Date';

  label total_amt='Amount';

  step x=prescribe_date y=total_amt / group=id justify=right;

  keylegend / across=2 valueattrs=(size=7);

  yaxis grid;

  xaxis grid;

run;

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 793 views
  • 3 likes
  • 2 in conversation