<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: swim lane plot for dose changes in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/swim-lane-plot-for-dose-changes/m-p/428589#M14815</link>
    <description>&lt;P&gt;For a custom plot like this, one way to do it would be to start with a blank set of axes, and then programmatically 'draw' the swim lanes in.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's some code that might get you started:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%let name=swim_lane_plot;
filename odsout '.';

PROC IMPORT OUT=my_data DATAFILE="Sample_data_updated.xls" DBMS=EXCEL REPLACE;
 RANGE="Sample_sas"; 
 GETNAMES=YES;
 MIXED=NO;
RUN;

proc sort data=my_data out=my_data;
by SUBJID acn1;
run;

%let scaler=.3;

data anno_lines; set my_data;
by SUBJID;
length function $8 color $12;
xsys='2'; ysys='2'; hsys='3'; when='a';
retain x level;
yc=SUBJID;
if first.SUBJID then do;
 level=0;
 x=0; function='move'; 
 output;
 end;
if acn='Initial Dose Level' then do;
 flag='Initial';
 x=x+duration;
 level=3;
 color='gray11';
 function='draw'; size=level*&amp;amp;scaler; 
 output;
 end;
if acn='Dose Reduced by 1 level' then do;
 x=x+duration;
 level=level-1;
 if level=2 then color='gray77';
 if level=1 then color='graybb';
 function='draw'; size=level*&amp;amp;scaler; 
 output;
 end;
if acn='dose increase' then do;
 x=x+duration;
 level=level+1;
 if level&amp;gt;=3 then color='gray11';
 if level=2 then color='gray77';
 if level=1 then color='graybb';
 function='draw'; size=level*&amp;amp;scaler; 
 output;
 end;
if acn='Dose pause' then do;
 x=x+duration;
 function='draw'; size=.01; color='gray11'; 
 output;
 end;
if acn='Discontinuation' then do;
 x=x+duration;
 function='label'; position='5'; text='X'; color='gray11'; 
 output;
 end;
run;


goptions device=png;
goptions xpixels=700 ypixels=1100;
goptions noborder;

ODS LISTING CLOSE;
ODS HTML path=odsout body="&amp;amp;name..htm" (title="Swim Lane Plot") style=sasweb;

goptions gunit=pct htitle=14pt ftitle="albany amt/bold" htext=10pt ftext="albany amt";
goptions ctext=gray33;

axis1 label=('Patient') major=none minor=none;

axis2 label=('Study Day') order=(0 to 250 by 50) minor=none offset=(0,0);

/* make the plot markers invisible (you'll be annotating the lines) */
symbol1 value=point interpol=none color=black;

title1 ls=1.5 "Custom Swim Lane Plot";

proc gplot data=my_data anno=anno_lines;
plot SUBJID*duration / 
 vaxis=axis1 haxis=axis2
 des='' name="&amp;amp;name";
run;

quit;
ODS HTML CLOSE;
ODS LISTING;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="swim_lane_plot.png" style="width: 423px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/17928iA8D331F12658D48C/image-dimensions/423x664?v=v2" width="423" height="664" role="button" title="swim_lane_plot.png" alt="swim_lane_plot.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 17 Jan 2018 20:09:21 GMT</pubDate>
    <dc:creator>GraphGuy</dc:creator>
    <dc:date>2018-01-17T20:09:21Z</dc:date>
    <item>
      <title>swim lane plot for dose changes</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/swim-lane-plot-for-dose-changes/m-p/428483#M14803</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to do swim lane plot for dose changes , find attached shell for reference, is there a direct way to get this graph,please help!&lt;/P&gt;&lt;P&gt;I found reference graphs for response but entire graph has bars in same dimensions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jan 2018 16:50:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/swim-lane-plot-for-dose-changes/m-p/428483#M14803</guid>
      <dc:creator>kiransas</dc:creator>
      <dc:date>2018-01-17T16:50:57Z</dc:date>
    </item>
    <item>
      <title>Re: swim lane plot for dose changes</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/swim-lane-plot-for-dose-changes/m-p/428491#M14804</link>
      <description>&lt;P&gt;Direct way? No. Is it possible, yes. You would need to post sample data at minimum if you want some help getting this done.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can look at the SGPLOT procedures for starters.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that when I say No, that's assuming you're not using SAS Clinical which may have automated reports (I have no idea) and are assuming you're using SAS EG/Studio/Base&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/187305"&gt;@kiransas&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to do swim lane plot for dose changes , find attached shell for reference, is there a direct way to get this graph,please help!&lt;/P&gt;
&lt;P&gt;I found reference graphs for response but entire graph has bars in same dimensions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jan 2018 17:00:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/swim-lane-plot-for-dose-changes/m-p/428491#M14804</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-01-17T17:00:04Z</dc:date>
    </item>
    <item>
      <title>Re: swim lane plot for dose changes</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/swim-lane-plot-for-dose-changes/m-p/428515#M14806</link>
      <description>&lt;P&gt;Hi Reeza,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your reply.&lt;/P&gt;&lt;P&gt;I have attached the sample data in excel.&lt;/P&gt;&lt;P&gt;I am using PC SAS.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jan 2018 18:01:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/swim-lane-plot-for-dose-changes/m-p/428515#M14806</guid>
      <dc:creator>kiransas</dc:creator>
      <dc:date>2018-01-17T18:01:28Z</dc:date>
    </item>
    <item>
      <title>Re: swim lane plot for dose changes</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/swim-lane-plot-for-dose-changes/m-p/428589#M14815</link>
      <description>&lt;P&gt;For a custom plot like this, one way to do it would be to start with a blank set of axes, and then programmatically 'draw' the swim lanes in.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's some code that might get you started:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%let name=swim_lane_plot;
filename odsout '.';

PROC IMPORT OUT=my_data DATAFILE="Sample_data_updated.xls" DBMS=EXCEL REPLACE;
 RANGE="Sample_sas"; 
 GETNAMES=YES;
 MIXED=NO;
RUN;

proc sort data=my_data out=my_data;
by SUBJID acn1;
run;

%let scaler=.3;

data anno_lines; set my_data;
by SUBJID;
length function $8 color $12;
xsys='2'; ysys='2'; hsys='3'; when='a';
retain x level;
yc=SUBJID;
if first.SUBJID then do;
 level=0;
 x=0; function='move'; 
 output;
 end;
if acn='Initial Dose Level' then do;
 flag='Initial';
 x=x+duration;
 level=3;
 color='gray11';
 function='draw'; size=level*&amp;amp;scaler; 
 output;
 end;
if acn='Dose Reduced by 1 level' then do;
 x=x+duration;
 level=level-1;
 if level=2 then color='gray77';
 if level=1 then color='graybb';
 function='draw'; size=level*&amp;amp;scaler; 
 output;
 end;
if acn='dose increase' then do;
 x=x+duration;
 level=level+1;
 if level&amp;gt;=3 then color='gray11';
 if level=2 then color='gray77';
 if level=1 then color='graybb';
 function='draw'; size=level*&amp;amp;scaler; 
 output;
 end;
if acn='Dose pause' then do;
 x=x+duration;
 function='draw'; size=.01; color='gray11'; 
 output;
 end;
if acn='Discontinuation' then do;
 x=x+duration;
 function='label'; position='5'; text='X'; color='gray11'; 
 output;
 end;
run;


goptions device=png;
goptions xpixels=700 ypixels=1100;
goptions noborder;

ODS LISTING CLOSE;
ODS HTML path=odsout body="&amp;amp;name..htm" (title="Swim Lane Plot") style=sasweb;

goptions gunit=pct htitle=14pt ftitle="albany amt/bold" htext=10pt ftext="albany amt";
goptions ctext=gray33;

axis1 label=('Patient') major=none minor=none;

axis2 label=('Study Day') order=(0 to 250 by 50) minor=none offset=(0,0);

/* make the plot markers invisible (you'll be annotating the lines) */
symbol1 value=point interpol=none color=black;

title1 ls=1.5 "Custom Swim Lane Plot";

proc gplot data=my_data anno=anno_lines;
plot SUBJID*duration / 
 vaxis=axis1 haxis=axis2
 des='' name="&amp;amp;name";
run;

quit;
ODS HTML CLOSE;
ODS LISTING;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="swim_lane_plot.png" style="width: 423px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/17928iA8D331F12658D48C/image-dimensions/423x664?v=v2" width="423" height="664" role="button" title="swim_lane_plot.png" alt="swim_lane_plot.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jan 2018 20:09:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/swim-lane-plot-for-dose-changes/m-p/428589#M14815</guid>
      <dc:creator>GraphGuy</dc:creator>
      <dc:date>2018-01-17T20:09:21Z</dc:date>
    </item>
    <item>
      <title>Re: swim lane plot for dose changes</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/swim-lane-plot-for-dose-changes/m-p/428594#M14816</link>
      <description>&lt;P&gt;Hi Robert,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&amp;nbsp; much for the help.I highly appreciate it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Kiran&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jan 2018 20:28:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/swim-lane-plot-for-dose-changes/m-p/428594#M14816</guid>
      <dc:creator>kiransas</dc:creator>
      <dc:date>2018-01-17T20:28:30Z</dc:date>
    </item>
    <item>
      <title>Re: swim lane plot for dose changes</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/swim-lane-plot-for-dose-changes/m-p/428896#M14836</link>
      <description>&lt;P&gt;Really appreciate the code provided, perfect for my current request. Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jan 2018 18:58:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/swim-lane-plot-for-dose-changes/m-p/428896#M14836</guid>
      <dc:creator>kiransas</dc:creator>
      <dc:date>2018-01-18T18:58:03Z</dc:date>
    </item>
  </channel>
</rss>

