<?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: Study calender plot in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Study-calender-plot/m-p/779801#M248415</link>
    <description>&lt;P&gt;This could get you a start.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data indata;
input subject  startdt : date9. enddt : date9. ;
format startdt enddt date9.;
datalines;
1001 08Jan2108 09Dec2020
1002 10Feb2019 10Jan2021
1003  20Mar2019 12Mar2021
1004  27Feb2019  13Nov2021
1005  01Mar2018  15Aug2021
1006  23Feb2019 28Jun2021
1007  18Apr2018 12Jul2020
1009  17Mar2019  20Oct2020
1010  12Sep2018  13Jan2019
;
run;

proc sgplot data=indata;
highlow y=subject low=startdt high=enddt;
xaxis  valuesformat=date9. max='20aug2021'd;
refline '01jan2020'd /axis=x label ;
run;&lt;/PRE&gt;</description>
    <pubDate>Thu, 11 Nov 2021 14:18:18 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2021-11-11T14:18:18Z</dc:date>
    <item>
      <title>Study calender plot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Study-calender-plot/m-p/779707#M248380</link>
      <description>&lt;P&gt;Hi Please let me know how below plot genrated in sas by using proc sgplot with higlow veritical procedure&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Y axis need display the Months of duarion&lt;/P&gt;&lt;P&gt;The X axis will be subejcts&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The data like below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data indata:
input subject $100 startdt date9. enddt date9. ;
datalines;
1001 08Jan2108 09Dec2020
1002 10Feb2019 10Jan2021
1003  20Mar2019 12Mar2021
1004  27Feb202  13Nov2021
1005  01Mar2018  15Aug200
1006  23Feb2019 28Jun2021
1007  18Apr2018 12Jul2020
1009  17Mar2019  20Oct2020
1010   12Sep2018  13Jan2019
;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Output plot :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="raja777pharma_0-1636608986539.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/65580i9E7CE04A762DBCEA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="raja777pharma_0-1636608986539.png" alt="raja777pharma_0-1636608986539.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Rajasekhar&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Nov 2021 05:37:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Study-calender-plot/m-p/779707#M248380</guid>
      <dc:creator>raja777pharma</dc:creator>
      <dc:date>2021-11-11T05:37:39Z</dc:date>
    </item>
    <item>
      <title>Re: Study calender plot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Study-calender-plot/m-p/779801#M248415</link>
      <description>&lt;P&gt;This could get you a start.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data indata;
input subject  startdt : date9. enddt : date9. ;
format startdt enddt date9.;
datalines;
1001 08Jan2108 09Dec2020
1002 10Feb2019 10Jan2021
1003  20Mar2019 12Mar2021
1004  27Feb2019  13Nov2021
1005  01Mar2018  15Aug2021
1006  23Feb2019 28Jun2021
1007  18Apr2018 12Jul2020
1009  17Mar2019  20Oct2020
1010  12Sep2018  13Jan2019
;
run;

proc sgplot data=indata;
highlow y=subject low=startdt high=enddt;
xaxis  valuesformat=date9. max='20aug2021'd;
refline '01jan2020'd /axis=x label ;
run;&lt;/PRE&gt;</description>
      <pubDate>Thu, 11 Nov 2021 14:18:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Study-calender-plot/m-p/779801#M248415</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-11-11T14:18:18Z</dc:date>
    </item>
    <item>
      <title>Re: Study calender plot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Study-calender-plot/m-p/779876#M248439</link>
      <description>&lt;P&gt;Steeling heavily from &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt; but 1) fixing the data in the first row where the Start is way after the End date,&lt;/P&gt;
&lt;P&gt;Adding a sort and Yaxis to get the data into a similar shape as the requested graph:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;PRE&gt;data indata;
input subject  startdt : date9. enddt : date9. ;
format startdt enddt date9.;
datalines;
1001 08Jan2018 09Dec2020
1002 10Feb2019 10Jan2021
1003  20Mar2019 12Mar2021
1004  27Feb2019  13Nov2021
1005  01Mar2018  15Aug2021
1006  23Feb2019 28Jun2021
1007  18Apr2018 12Jul2020
1009  17Mar2019  20Oct2020
1010  12Sep2018  13Jan2019
;
run;
proc sort data=indata;
  by descending startdt;
run;
proc sgplot data=indata;
highlow y=subject low=startdt high=enddt;
xaxis  valuesformat=date9. max='20aug2021'd;
refline '01jan2020'd /axis=x label='JAN 2020' ;
yaxis type=discrete discreteorder=data ;
run;&lt;/PRE&gt;
&lt;P&gt;The Sort by Descending is because the graph wants to know which value goes closest to the Xaxis first and builds away from the axis. So you want the largest Start value first to appear at the bottom. This works with the Yaxis optionsType and Discreteorder=data to get the data into the apparently desired order.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Nov 2021 23:18:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Study-calender-plot/m-p/779876#M248439</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-11-11T23:18:18Z</dc:date>
    </item>
    <item>
      <title>Re: Study calender plot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Study-calender-plot/m-p/779967#M248465</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thak you for provuding coding details.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just want know how to anotate graph (insert the text inside the label as per below).&lt;/P&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="raja777pharma_1-1636724496230.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/65642i93E8683A9CD8F55D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="raja777pharma_1-1636724496230.png" alt="raja777pharma_1-1636724496230.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using below code.&lt;/P&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="raja777pharma_0-1636724371751.png" style="width: 683px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/65641i969B85BA9E2396E9/image-dimensions/683x99?v=v2" width="683" height="99" role="button" title="raja777pharma_0-1636724371751.png" alt="raja777pharma_0-1636724371751.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Rajasekhar&lt;/P&gt;</description>
      <pubDate>Fri, 12 Nov 2021 13:54:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Study-calender-plot/m-p/779967#M248465</guid>
      <dc:creator>raja777pharma</dc:creator>
      <dc:date>2021-11-12T13:54:25Z</dc:date>
    </item>
    <item>
      <title>Re: Study calender plot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Study-calender-plot/m-p/780102#M248534</link>
      <description>&lt;P&gt;Here could give you a start.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1636803373639.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/65665iCBC10B940664BAA0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1636803373639.png" alt="Ksharp_0-1636803373639.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data indata;
input subject  startdt : date9. enddt : date9. ;
format startdt enddt date9.;
datalines;
1001 08Jan2018 09Dec2020
1002 10Feb2019 10Jan2021
1003  20Mar2019 12Mar2021
1004  27Feb2019  13Nov2021
1005  01Mar2018  15Aug2021
1006  23Feb2019 28Jun2021
1007  18Apr2018 12Jul2020
1009  17Mar2019  20Oct2020
1010  12Sep2018  13Jan2019
;
run;
proc sort data=indata;
  by descending startdt;
run;
proc summary data=indata;
var startdt enddt subject;
output out=min_max min(startdt)=min max(enddt)=max ;
run;
data want;
 set indata;
 if _n_=1 then do;
   set min_max;
   mean=1010;_mean=1007;
   high1='01jan2020'd;mean1=mean(min,'01jan2020'd);text1='78% subject';
   high2='01jan2020'd;mean2=mean('01jan2020'd,max);text2='22% subject';  
 end;
  else call missing(min,max,mean);
run;

proc sgplot data=want noautolegend;
highlow y=subject low=startdt high=enddt;

highlow y=mean low=min high=high1/highcap=filledarrow lowcap=filledarrow lineattrs=(pattern=dash color=red thickness=4);
text y=_mean x=mean1 text=text1/strip CONTRIBUTEOFFSETS=none textattrs=(size=20 color=red);

highlow y=mean low=high2 high=max/highcap=filledarrow lowcap=filledarrow lineattrs=(pattern=dash color=red thickness=4);
text y=_mean x=mean2 text=text2/strip CONTRIBUTEOFFSETS=none textattrs=(size=20 color=red);

xaxis  valuesformat=date9. label=' ';
refline '01jan2020'd /axis=x label='JAN 2020' lineattrs=(pattern=dash color=red thickness=4);
yaxis type=discrete discreteorder=data  label=' ';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 13 Nov 2021 11:36:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Study-calender-plot/m-p/780102#M248534</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-11-13T11:36:21Z</dc:date>
    </item>
  </channel>
</rss>

