<?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: How to obtain increase/decrease price change by date in sas? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-obtain-increase-decrease-price-change-by-date-in-sas/m-p/209062#M267269</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is a solution, one comment though.&amp;nbsp; Before checking your solution I wrote _N_ &amp;gt; 1 before first.date, didn't think you would want the first record.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;infile cards;&lt;/P&gt;&lt;P&gt;informat date ddmmyy10.;&lt;/P&gt;&lt;P&gt;format date mmddyy10.;&lt;/P&gt;&lt;P&gt;input Storeid$ ProdId$ Date SP;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;1 101 22/1/2013 18&lt;/P&gt;&lt;P&gt;1 101 23/1/2013 18&lt;/P&gt;&lt;P&gt;1 101 24/1/2013 19&lt;/P&gt;&lt;P&gt;1 101 25/1/2013 18&lt;/P&gt;&lt;P&gt;1 101 26/1/2013 19&lt;/P&gt;&lt;P&gt;1 101 27/1/2013 19&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;_l_sp = lag(sp);&lt;/P&gt;&lt;P&gt;by date notsorted;&lt;/P&gt;&lt;P&gt;if first.date and _l_sp &amp;gt; sp then _increase = 1;&lt;/P&gt;&lt;P&gt;if first.date and _l_sp &amp;lt; sp then _decrease = 1;&lt;/P&gt;&lt;P&gt;if _increase = 1 or _decrease = 1 then output;&lt;/P&gt;&lt;P&gt;drop _:;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 18 Jun 2015 12:40:50 GMT</pubDate>
    <dc:creator>Steelers_In_DC</dc:creator>
    <dc:date>2015-06-18T12:40:50Z</dc:date>
    <item>
      <title>How to obtain increase/decrease price change by date in sas?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-obtain-increase-decrease-price-change-by-date-in-sas/m-p/209061#M267268</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have a data set with 4 variable, data set is shown below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Storeid ProdId Date SP&lt;/P&gt;&lt;P&gt;1 101 22/1/2013 18&lt;/P&gt;&lt;P&gt;1 101 &lt;SPAN style="font-size: 13.3333330154419px;"&gt;23/1/2013 18&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;1 101 &lt;SPAN style="font-size: 13.3333330154419px;"&gt;24/1/2013 19&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;1 101 &lt;SPAN style="font-size: 13.3333330154419px;"&gt;25/1/2013 18&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;1 101 &lt;SPAN style="font-size: 13.3333330154419px;"&gt;26/1/2013 19&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;1 101 &lt;SPAN style="font-size: 13.3333330154419px;"&gt;27/1/2013 19&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Require output is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;Storeid ProdId Date SP&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;1 101 22/1/2013 18&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;1 101 &lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;24/1/2013 19&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;1 101 &lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;25/1/2013 18&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;1 101 &lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;26/1/2013 19&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;How to &lt;/SPAN&gt;retrieve particular record when price is increasing or decresing?&lt;SPAN style="font-size: 13.3333330154419px;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Jun 2015 12:10:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-obtain-increase-decrease-price-change-by-date-in-sas/m-p/209061#M267268</guid>
      <dc:creator>Ganeshk</dc:creator>
      <dc:date>2015-06-18T12:10:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to obtain increase/decrease price change by date in sas?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-obtain-increase-decrease-price-change-by-date-in-sas/m-p/209062#M267269</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is a solution, one comment though.&amp;nbsp; Before checking your solution I wrote _N_ &amp;gt; 1 before first.date, didn't think you would want the first record.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;infile cards;&lt;/P&gt;&lt;P&gt;informat date ddmmyy10.;&lt;/P&gt;&lt;P&gt;format date mmddyy10.;&lt;/P&gt;&lt;P&gt;input Storeid$ ProdId$ Date SP;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;1 101 22/1/2013 18&lt;/P&gt;&lt;P&gt;1 101 23/1/2013 18&lt;/P&gt;&lt;P&gt;1 101 24/1/2013 19&lt;/P&gt;&lt;P&gt;1 101 25/1/2013 18&lt;/P&gt;&lt;P&gt;1 101 26/1/2013 19&lt;/P&gt;&lt;P&gt;1 101 27/1/2013 19&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;_l_sp = lag(sp);&lt;/P&gt;&lt;P&gt;by date notsorted;&lt;/P&gt;&lt;P&gt;if first.date and _l_sp &amp;gt; sp then _increase = 1;&lt;/P&gt;&lt;P&gt;if first.date and _l_sp &amp;lt; sp then _decrease = 1;&lt;/P&gt;&lt;P&gt;if _increase = 1 or _decrease = 1 then output;&lt;/P&gt;&lt;P&gt;drop _:;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Jun 2015 12:40:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-obtain-increase-decrease-price-change-by-date-in-sas/m-p/209062#M267269</guid>
      <dc:creator>Steelers_In_DC</dc:creator>
      <dc:date>2015-06-18T12:40:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to obtain increase/decrease price change by date in sas?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-obtain-increase-decrease-price-change-by-date-in-sas/m-p/209063#M267270</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; by date notsorted;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if sp=lag(sp) then delete;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Jun 2015 13:23:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-obtain-increase-decrease-price-change-by-date-in-sas/m-p/209063#M267270</guid>
      <dc:creator>slchen</dc:creator>
      <dc:date>2015-06-18T13:23:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to obtain increase/decrease price change by date in sas?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-obtain-increase-decrease-price-change-by-date-in-sas/m-p/209064#M267271</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Another opinion:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; by StoreID ProdID SP notsorted;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if first.sp;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited a couple of times, but this should do the trick.&amp;nbsp; Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Jun 2015 13:37:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-obtain-increase-decrease-price-change-by-date-in-sas/m-p/209064#M267271</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-06-18T13:37:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to obtain increase/decrease price change by date in sas?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-obtain-increase-decrease-price-change-by-date-in-sas/m-p/209065#M267272</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;And so what would the right outcome be for this data?&amp;nbsp; And what do your solutions actually generate?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Storeid ProdId Date SP&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;1 101 22/1/2013 18&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;1 101 &lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 13.3333330154419px; font-family: inherit;"&gt;23/1/2013 18&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;1 101 &lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 13.3333330154419px; font-family: inherit;"&gt;24/1/2013 19&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;1 101 &lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 13.3333330154419px; font-family: inherit;"&gt;25/1/2013 18&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;1 101 &lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 13.3333330154419px; font-family: inherit;"&gt;26/1/2013 19&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;1 101 &lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 13.3333330154419px; font-family: inherit;"&gt;27/1/2013 19&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;1 102 22/1/2013 19&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;1 102 &lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 13.3333330154419px; font-family: inherit;"&gt;23/1/2013 20&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;1 102 &lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 13.3333330154419px; font-family: inherit;"&gt;24/1/2013 20&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;1 102 &lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 13.3333330154419px; font-family: inherit;"&gt;25/1/2013 21&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Jun 2015 13:53:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-obtain-increase-decrease-price-change-by-date-in-sas/m-p/209065#M267272</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-06-19T13:53:34Z</dc:date>
    </item>
  </channel>
</rss>

