<?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 Cumulative Data Step With Varying Lenght in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Cumulative-Data-Step-With-Varying-Lenght/m-p/11786#M1167</link>
    <description>Dear all,&lt;BR /&gt;
&lt;BR /&gt;
I have a following problem. Suppose I have data in form of:&lt;BR /&gt;
&lt;BR /&gt;
Failing for (in months)                 First Date of Fail&lt;BR /&gt;
11	                                20APR2011&lt;BR /&gt;
7	                                25OCT2011&lt;BR /&gt;
2	                                08APR2011&lt;BR /&gt;
3	                                13APR2011&lt;BR /&gt;
3	                                26APR2011&lt;BR /&gt;
6	                                02MAY2011&lt;BR /&gt;
7	                                03MAY2011&lt;BR /&gt;
6	                                11MAY2011&lt;BR /&gt;
&lt;BR /&gt;
What I'm trying to achieve is to have a cumulative sum of 'Failings' by month and year, i.e. get columns in a form of&lt;BR /&gt;
Year         Month        No. of Failed&lt;BR /&gt;
2011            4                   x&lt;BR /&gt;
2011            5                   y&lt;BR /&gt;
etc.&lt;BR /&gt;
&lt;BR /&gt;
It is easy to obtain cumulative sum of the column 'First Date of Fail', however I do not know how to incorporate the column 'Failing for (in months)' into the cumulative some (i.e. for the first observation, it will be counted as a fail for 11 months in the row including the first month of the fail)&lt;BR /&gt;
&lt;BR /&gt;
Could anyone suggest an appropriate code or procedure in SAS?&lt;BR /&gt;
&lt;BR /&gt;
Thank you,&lt;BR /&gt;
&lt;BR /&gt;
Simi</description>
    <pubDate>Mon, 13 Jun 2011 10:42:33 GMT</pubDate>
    <dc:creator>Simi</dc:creator>
    <dc:date>2011-06-13T10:42:33Z</dc:date>
    <item>
      <title>Cumulative Data Step With Varying Lenght</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cumulative-Data-Step-With-Varying-Lenght/m-p/11786#M1167</link>
      <description>Dear all,&lt;BR /&gt;
&lt;BR /&gt;
I have a following problem. Suppose I have data in form of:&lt;BR /&gt;
&lt;BR /&gt;
Failing for (in months)                 First Date of Fail&lt;BR /&gt;
11	                                20APR2011&lt;BR /&gt;
7	                                25OCT2011&lt;BR /&gt;
2	                                08APR2011&lt;BR /&gt;
3	                                13APR2011&lt;BR /&gt;
3	                                26APR2011&lt;BR /&gt;
6	                                02MAY2011&lt;BR /&gt;
7	                                03MAY2011&lt;BR /&gt;
6	                                11MAY2011&lt;BR /&gt;
&lt;BR /&gt;
What I'm trying to achieve is to have a cumulative sum of 'Failings' by month and year, i.e. get columns in a form of&lt;BR /&gt;
Year         Month        No. of Failed&lt;BR /&gt;
2011            4                   x&lt;BR /&gt;
2011            5                   y&lt;BR /&gt;
etc.&lt;BR /&gt;
&lt;BR /&gt;
It is easy to obtain cumulative sum of the column 'First Date of Fail', however I do not know how to incorporate the column 'Failing for (in months)' into the cumulative some (i.e. for the first observation, it will be counted as a fail for 11 months in the row including the first month of the fail)&lt;BR /&gt;
&lt;BR /&gt;
Could anyone suggest an appropriate code or procedure in SAS?&lt;BR /&gt;
&lt;BR /&gt;
Thank you,&lt;BR /&gt;
&lt;BR /&gt;
Simi</description>
      <pubDate>Mon, 13 Jun 2011 10:42:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cumulative-Data-Step-With-Varying-Lenght/m-p/11786#M1167</guid>
      <dc:creator>Simi</dc:creator>
      <dc:date>2011-06-13T10:42:33Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative Data Step With Varying Lenght</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cumulative-Data-Step-With-Varying-Lenght/m-p/11787#M1168</link>
      <description>Hope below code is appropriate.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
data have;&lt;BR /&gt;
  infile datalines truncover dlm=' ';&lt;BR /&gt;
  input NoOfFailure:8. DateFirstFailure:date9.;&lt;BR /&gt;
  format DateFirstFailure date9.;&lt;BR /&gt;
  datalines;&lt;BR /&gt;
11 20APR2011&lt;BR /&gt;
7 25OCT2011&lt;BR /&gt;
2 08APR2011&lt;BR /&gt;
3 13APR2011&lt;BR /&gt;
3 26APR2011&lt;BR /&gt;
6 02MAY2011&lt;BR /&gt;
7 03MAY2011&lt;BR /&gt;
6 11MAY2011&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
Data V_FailureByMonth(keep=YearMonthFailure) / view=V_FailureByMonth;&lt;BR /&gt;
  set have;&lt;BR /&gt;
  format YearMonthFailure yymon7.;&lt;BR /&gt;
  do i=0 to (NoOfFailure-1);&lt;BR /&gt;
    YearMonthFailure=intnx('month',DateFirstFailure,i,'b');&lt;BR /&gt;
    output;&lt;BR /&gt;
  end;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
proc freq data=V_FailureByMonth noprint;&lt;BR /&gt;
  table YearMonthFailure / outcum out=want(keep=YearMonthFailure cum_freq);&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
proc print data=want;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
HTH&lt;BR /&gt;
Patrick</description>
      <pubDate>Mon, 13 Jun 2011 11:26:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cumulative-Data-Step-With-Varying-Lenght/m-p/11787#M1168</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2011-06-13T11:26:45Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative Data Step With Varying Lenght</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cumulative-Data-Step-With-Varying-Lenght/m-p/11788#M1169</link>
      <description>Thanks a lot Patrick, that's exactly what I was after!!!</description>
      <pubDate>Mon, 13 Jun 2011 12:33:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cumulative-Data-Step-With-Varying-Lenght/m-p/11788#M1169</guid>
      <dc:creator>Simi</dc:creator>
      <dc:date>2011-06-13T12:33:36Z</dc:date>
    </item>
  </channel>
</rss>

