<?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: Customer Information Summarized in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Customer-Information-Summarized/m-p/486743#M287191</link>
    <description>&lt;P&gt;Do you mean your status_date is a datetime value and not a date value?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In that case,&lt;/P&gt;
&lt;P&gt;if intnx('year', today(),-2,'s')&amp;lt;&lt;EM&gt;&lt;STRONG&gt;datepart(Status_Date)&lt;/STRONG&gt;&lt;/EM&gt;&amp;lt;=today() and Status in ('Closed','Pending') then Ever_Pending_Close_0_3_Years='YES';&lt;BR /&gt;If intnx('year', today(),-4,'s')&amp;lt;&lt;STRONG&gt;datepart(Status_Date)&lt;/STRONG&gt;&amp;lt;=intnx('year', today(),-2,'s') and Status in ('Closed','Pending') then Ever_Pending_Closed_3_5_Years='YES';&lt;/P&gt;</description>
    <pubDate>Tue, 14 Aug 2018 16:14:56 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2018-08-14T16:14:56Z</dc:date>
    <item>
      <title>Customer Information Summarized</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Customer-Information-Summarized/m-p/486677#M287186</link>
      <description>&lt;P&gt;Hi Community,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following customer data that has multiple records per customer (this is just a sample):&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Customer_ID&lt;/TD&gt;&lt;TD&gt;Name&lt;/TD&gt;&lt;TD&gt;Status&lt;/TD&gt;&lt;TD&gt;Status_Date&lt;/TD&gt;&lt;/TR&gt;&lt;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gt;&lt;TD&gt;08/11/2017&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;9120&lt;/TD&gt;&lt;TD&gt;BBB&lt;/TD&gt;&lt;TD&gt;Closed&lt;/TD&gt;&lt;TD&gt;09/01/2017&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And I need to create only one line that summarizes the needed information from the above sample data, as follows:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Customer_ID&lt;/TD&gt;&lt;TD&gt;Name&lt;/TD&gt;&lt;TD&gt;Ever_Pending_Close_0_3_Years&lt;/TD&gt;&lt;TD&gt;Ever_Pending_Closed_3_5_Years&lt;/TD&gt;&lt;TD&gt;Open_Now&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1234&lt;/TD&gt;&lt;TD&gt;ABC&lt;/TD&gt;&lt;TD&gt;Yes&lt;/TD&gt;&lt;TD&gt;No&lt;/TD&gt;&lt;TD&gt;Yes&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3421&lt;/TD&gt;&lt;TD&gt;XYZ&lt;/TD&gt;&lt;TD&gt;No&lt;/TD&gt;&lt;TD&gt;Yes&lt;/TD&gt;&lt;TD&gt;Yes&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;9120&lt;/TD&gt;&lt;TD&gt;BBB&lt;/TD&gt;&lt;TD&gt;Yes&lt;/TD&gt;&lt;TD&gt;No&lt;/TD&gt;&lt;TD&gt;No&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The periods above are:&lt;/P&gt;&lt;P&gt;Ever_Pending_Close_0_3_Years = ever closed or pending in the last three years from today?&lt;/P&gt;&lt;P&gt;Ever_Pending_Closed_3_5_Years = ever closed or pending in the last FIVE years, but not in the last three years (between 3-5 years) from today?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!!&lt;/P&gt;</description>
      <pubDate>Tue, 14 Aug 2018 14:14:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Customer-Information-Summarized/m-p/486677#M287186</guid>
      <dc:creator>altijani</dc:creator>
      <dc:date>2018-08-14T14:14:18Z</dc:date>
    </item>
    <item>
      <title>Re: Customer Information Summarized</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Customer-Information-Summarized/m-p/486687#M287187</link>
      <description>&lt;P&gt;Do it stepwise, assign groups, then summarise based on the groups.&amp;nbsp; Just a rough idea here (post test data in the form of a datastep, not here to type that in):&lt;/P&gt;
&lt;PRE&gt;data inter;
  set have;
  retain open_date;
  length group $200;
  by customer_id;
  if first.customer_id then open_date=status_date;
  if status="Open" and open_date=. then open_date=status_date;
  if status="Closed" then do;
    group=intnx('year',open_date,status_date);
    open_date=.;
  end;
  if last.customer_id and open_date ne . then group=open_now;
run;&lt;/PRE&gt;
&lt;P&gt;Then transpose up distinct records of customer_id and group.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Aug 2018 14:31:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Customer-Information-Summarized/m-p/486687#M287187</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-08-14T14:31:59Z</dc:date>
    </item>
    <item>
      <title>Re: Customer Information Summarized</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Customer-Information-Summarized/m-p/486716#M287189</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input Customer_ID	Name $	Status $	Status_Date :mmddyy10.;
format Status_Date mmddyy10.;
cards;
1234	ABC	Open	01/02/2016
1234	ABC	Closed	06/07/2017
1234	ABC	Open	01/15/2018
3421	XYZ	Open	09/22/2014
3421	XYZ	Pending	09/06/2015
3421	XYZ	Closed	06/14/2016
3421	XYZ	Open	06/12/2017
9120	BBB	Open	02/05/2016
9120	BBB	Open	08/11/2017
9120	BBB	Closed	09/01/2017
;
data want;
if 0 then set have;
Ever_Pending_Close_0_3_Years='NO   ';
Ever_Pending_Closed_3_5_Years='NO  ';
Open_Now='NO   ';
do until(last.name);
set have;
by customer_id name notsorted;
if intnx('year', today(),-2,'s')&amp;lt;(Status_Date)&amp;lt;=today() and Status in ('Closed','Pending') then Ever_Pending_Close_0_3_Years='YES';
If intnx('year', today(),-4,'s')&amp;lt;(Status_Date)&amp;lt;=intnx('year', today(),-2,'s') and Status in ('Closed','Pending') then Ever_Pending_Closed_3_5_Years='YES';
if last.name and status='Open' then Open_Now='YES';
end;
drop Status 	Status_Date;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 14 Aug 2018 15:18:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Customer-Information-Summarized/m-p/486716#M287189</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-08-14T15:18:27Z</dc:date>
    </item>
    <item>
      <title>Re: Customer Information Summarized</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Customer-Information-Summarized/m-p/486735#M287190</link>
      <description>&lt;P&gt;Thanks Novinosrin&lt;/P&gt;&lt;P&gt;Everything seems working except that my date format is this: DATETIME26.6, which results in not calculating the periods at all.&lt;/P&gt;&lt;P&gt;Any workaround?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 14 Aug 2018 15:52:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Customer-Information-Summarized/m-p/486735#M287190</guid>
      <dc:creator>altijani</dc:creator>
      <dc:date>2018-08-14T15:52:15Z</dc:date>
    </item>
    <item>
      <title>Re: Customer Information Summarized</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Customer-Information-Summarized/m-p/486743#M287191</link>
      <description>&lt;P&gt;Do you mean your status_date is a datetime value and not a date value?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In that case,&lt;/P&gt;
&lt;P&gt;if intnx('year', today(),-2,'s')&amp;lt;&lt;EM&gt;&lt;STRONG&gt;datepart(Status_Date)&lt;/STRONG&gt;&lt;/EM&gt;&amp;lt;=today() and Status in ('Closed','Pending') then Ever_Pending_Close_0_3_Years='YES';&lt;BR /&gt;If intnx('year', today(),-4,'s')&amp;lt;&lt;STRONG&gt;datepart(Status_Date)&lt;/STRONG&gt;&amp;lt;=intnx('year', today(),-2,'s') and Status in ('Closed','Pending') then Ever_Pending_Closed_3_5_Years='YES';&lt;/P&gt;</description>
      <pubDate>Tue, 14 Aug 2018 16:14:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Customer-Information-Summarized/m-p/486743#M287191</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-08-14T16:14:56Z</dc:date>
    </item>
  </channel>
</rss>

