<?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: Macro or data step to retrieve a switch date, Please Help..Thank you in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-or-data-step-to-retrieve-a-switch-date-Please-Help-Thank/m-p/228333#M41240</link>
    <description>Use a data step using BY and first./last. processing with RETAIN.</description>
    <pubDate>Sat, 03 Oct 2015 20:18:33 GMT</pubDate>
    <dc:creator>LinusH</dc:creator>
    <dc:date>2015-10-03T20:18:33Z</dc:date>
    <item>
      <title>Macro or data step to retrieve a switch date, Please Help..Thank you</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-or-data-step-to-retrieve-a-switch-date-Please-Help-Thank/m-p/228324#M41238</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have&amp;nbsp;aroound 10,000 customers&amp;nbsp;who switched from one product_id to another. I would like to identify when is the Yearmonth when the Target_field changes from 1 to 0. I am interested to see what was the yearmonth they went from 1 to 0. But not from 0 to 1. Below is an example of how my current data looks like per customer. This customers started with Target_field=1 and he switched to 0 in Year=&lt;STRONG&gt;201406.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your Help would be much appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank You&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;id&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;prod_id&amp;nbsp;Year Target_field&lt;BR /&gt;19081&amp;nbsp;2338&amp;nbsp;201402&amp;nbsp;1&lt;BR /&gt;19081&amp;nbsp;2338&amp;nbsp;201403&amp;nbsp;1&lt;BR /&gt;19081&amp;nbsp;2338&amp;nbsp;201404&amp;nbsp;1&lt;BR /&gt;19081&amp;nbsp;2338&amp;nbsp;201405&amp;nbsp;1&lt;BR /&gt;&lt;STRONG&gt;19081&amp;nbsp;2486&amp;nbsp;201406&amp;nbsp;0&lt;/STRONG&gt;&lt;BR /&gt;19081&amp;nbsp;2486&amp;nbsp;201407&amp;nbsp;0&lt;BR /&gt;19081&amp;nbsp;2486&amp;nbsp;201408&amp;nbsp;0&lt;BR /&gt;19081&amp;nbsp;2486&amp;nbsp;201409&amp;nbsp;0&lt;BR /&gt;19081&amp;nbsp;2486&amp;nbsp;201410&amp;nbsp;0&lt;BR /&gt;19081&amp;nbsp;2486&amp;nbsp;201411&amp;nbsp;0&lt;BR /&gt;19081&amp;nbsp;2486&amp;nbsp;201412&amp;nbsp;0&lt;BR /&gt;19081&amp;nbsp;2486&amp;nbsp;201501&amp;nbsp;0&lt;BR /&gt;19081&amp;nbsp;2486&amp;nbsp;201502&amp;nbsp;0&lt;BR /&gt;19081&amp;nbsp;2486&amp;nbsp;201503&amp;nbsp;0&lt;BR /&gt;19081&amp;nbsp;2486&amp;nbsp;201504&amp;nbsp;0&lt;BR /&gt;19081&amp;nbsp;2486&amp;nbsp;201505&amp;nbsp;0&lt;BR /&gt;19081&amp;nbsp;2486&amp;nbsp;201506&amp;nbsp;0&lt;BR /&gt;19081&amp;nbsp;2486&amp;nbsp;201507&amp;nbsp;0&lt;BR /&gt;19081&amp;nbsp;2486&amp;nbsp;201508&amp;nbsp;0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 03 Oct 2015 15:44:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-or-data-step-to-retrieve-a-switch-date-Please-Help-Thank/m-p/228324#M41238</guid>
      <dc:creator>Kanyange</dc:creator>
      <dc:date>2015-10-03T15:44:28Z</dc:date>
    </item>
    <item>
      <title>Re: Macro or data step to retrieve a switch date, Please Help..Thank you</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-or-data-step-to-retrieve-a-switch-date-Please-Help-Thank/m-p/228333#M41240</link>
      <description>Use a data step using BY and first./last. processing with RETAIN.</description>
      <pubDate>Sat, 03 Oct 2015 20:18:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-or-data-step-to-retrieve-a-switch-date-Please-Help-Thank/m-p/228333#M41240</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2015-10-03T20:18:33Z</dc:date>
    </item>
    <item>
      <title>Re: Macro or data step to retrieve a switch date, Please Help..Thank you</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-or-data-step-to-retrieve-a-switch-date-Please-Help-Thank/m-p/228340#M41244</link>
      <description>&lt;P&gt;Simple BY processing can do this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data switches;
set have; by id target_field notsorted;
if 
    first.target_field and 
    not first.id and 
    target_field=0 then output;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 04 Oct 2015 01:48:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-or-data-step-to-retrieve-a-switch-date-Please-Help-Thank/m-p/228340#M41244</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2015-10-04T01:48:00Z</dc:date>
    </item>
  </channel>
</rss>

