<?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 Range selection based of lowest price in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Range-selection-based-of-lowest-price/m-p/543497#M150246</link>
    <description>&lt;P&gt;I have the below table which gives you prices for a product from a date range. But as you can see there are multiple price is available for the&amp;nbsp;same date.So I wanted to have a new range where price is lowest for that day i.e.&lt;/P&gt;&lt;P&gt;if we talk about 02-jan-2018 for product A there are price 28,26,28,10 but i will consider the price 10 because thats the lowest in that range.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Product&lt;/TD&gt;&lt;TD&gt;on_sale_date&lt;/TD&gt;&lt;TD&gt;off_sale_date&lt;/TD&gt;&lt;TD&gt;Price&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;01-Jan-18&lt;/TD&gt;&lt;TD&gt;07-Jan-18&lt;/TD&gt;&lt;TD&gt;28&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;02-Jan-18&lt;/TD&gt;&lt;TD&gt;08-Jan-18&lt;/TD&gt;&lt;TD&gt;26&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;02-Jan-18&lt;/TD&gt;&lt;TD&gt;07-Jan-18&lt;/TD&gt;&lt;TD&gt;28&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;04-Jan-18&lt;/TD&gt;&lt;TD&gt;10-Jan-18&lt;/T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t;c&lt;/TD&gt;&lt;TD&gt;02-Jan-18&lt;/TD&gt;&lt;TD&gt;08-Jan-18&lt;/TD&gt;&lt;TD&gt;30&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So my table will look like this ( it creates a new range which takes the lowest price in that period.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Product&lt;/TD&gt;&lt;TD&gt;new_on_sale_date&lt;/TD&gt;&lt;TD&gt;new_off_sale_date&lt;/TD&gt;&lt;TD&gt;Price&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;01-Jan-18&lt;/TD&gt;&lt;TD&gt;01-Jan-18&lt;/TD&gt;&lt;TD&gt;28&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;02-Jan-18&lt;/TD&gt;&lt;TD&gt;10-Jan-18&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;11-Jan-18&lt;/TD&gt;&lt;TD&gt;14-Jan-14&lt;/TD&gt;&lt;TD&gt;14&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;02-Jan-18&lt;/TD&gt;&lt;TD&gt;03-Jan-18&lt;/TD&gt;&lt;TD&gt;27&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;04-Jan-18&lt;/TD&gt;&lt;TD&gt;12-Jan-18&lt;/TD&gt;&lt;TD&gt;16&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;13-Jan-18&lt;/TD&gt;&lt;TD&gt;13-Jan-18&lt;/TD&gt;&lt;TD&gt;30&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;c&lt;/TD&gt;&lt;TD&gt;02-Jan-18&lt;/TD&gt;&lt;TD&gt;06-Jan-18&lt;/TD&gt;&lt;TD&gt;24&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;c&lt;/TD&gt;&lt;TD&gt;07-Jan-18&lt;/TD&gt;&lt;TD&gt;08-Jan-18&lt;/TD&gt;&lt;TD&gt;24&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note:&lt;/P&gt;&lt;P&gt;1) There is no limitation for number of records at any level.&lt;/P&gt;&lt;P&gt;2) Unique level is Product+on_sale_date+off_sale_date+price.&lt;/P&gt;&lt;P&gt;3) I am not considering a solution&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Where i need to put all the record on day wise first&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;And then choose the lowest one&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;And then create range again.&lt;/P&gt;&lt;P&gt;I wanted to have this data without creating any table&amp;nbsp;on day wise because the size of data is too huge to create on day wise.&lt;/P&gt;&lt;P&gt;Basically I am looking for an optimised&amp;nbsp;query which can hendle&amp;nbsp;300 Gb data rather than just a simple query .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 15 Mar 2019 12:08:59 GMT</pubDate>
    <dc:creator>Srigyan</dc:creator>
    <dc:date>2019-03-15T12:08:59Z</dc:date>
    <item>
      <title>Range selection based of lowest price</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Range-selection-based-of-lowest-price/m-p/543497#M150246</link>
      <description>&lt;P&gt;I have the below table which gives you prices for a product from a date range. But as you can see there are multiple price is available for the&amp;nbsp;same date.So I wanted to have a new range where price is lowest for that day i.e.&lt;/P&gt;&lt;P&gt;if we talk about 02-jan-2018 for product A there are price 28,26,28,10 but i will consider the price 10 because thats the lowest in that range.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Product&lt;/TD&gt;&lt;TD&gt;on_sale_date&lt;/TD&gt;&lt;TD&gt;off_sale_date&lt;/TD&gt;&lt;TD&gt;Price&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;01-Jan-18&lt;/TD&gt;&lt;TD&gt;07-Jan-18&lt;/TD&gt;&lt;TD&gt;28&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;02-Jan-18&lt;/TD&gt;&lt;TD&gt;08-Jan-18&lt;/TD&gt;&lt;TD&gt;26&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;02-Jan-18&lt;/TD&gt;&lt;TD&gt;07-Jan-18&lt;/TD&gt;&lt;TD&gt;28&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;04-Jan-18&lt;/TD&gt;&lt;TD&gt;10-Jan-18&lt;/TD&gt;&lt;TD&gt;21&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;02-Jan-18&lt;/TD&gt;&lt;TD&gt;10-Jan-18&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt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lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;c&lt;/TD&gt;&lt;TD&gt;07-Jan-18&lt;/TD&gt;&lt;TD&gt;08-Jan-18&lt;/TD&gt;&lt;TD&gt;24&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note:&lt;/P&gt;&lt;P&gt;1) There is no limitation for number of records at any level.&lt;/P&gt;&lt;P&gt;2) Unique level is Product+on_sale_date+off_sale_date+price.&lt;/P&gt;&lt;P&gt;3) I am not considering a solution&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Where i need to put all the record on day wise first&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;And then choose the lowest one&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;And then create range again.&lt;/P&gt;&lt;P&gt;I wanted to have this data without creating any table&amp;nbsp;on day wise because the size of data is too huge to create on day wise.&lt;/P&gt;&lt;P&gt;Basically I am looking for an optimised&amp;nbsp;query which can hendle&amp;nbsp;300 Gb data rather than just a simple query .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2019 12:08:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Range-selection-based-of-lowest-price/m-p/543497#M150246</guid>
      <dc:creator>Srigyan</dc:creator>
      <dc:date>2019-03-15T12:08:59Z</dc:date>
    </item>
    <item>
      <title>Re: Range selection based of lowest price</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Range-selection-based-of-lowest-price/m-p/543506#M150252</link>
      <description>&lt;P&gt;An SQL query in general would sort the data behind the scenes just the same as you would yourself, it just hides that step from you.&lt;/P&gt;
&lt;P&gt;Why do you have a need to use SQL for this, is the data not in SAS?&amp;nbsp; If so then consider an SQL forum.&amp;nbsp; If its in SAS, then use SAS.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As for the data, your going to have to do some sort of processing on it, no getting away from that.&amp;nbsp; I would expand the data so each date is a single element, e.g:&lt;/P&gt;
&lt;PRE&gt;data inter (drop=on_sale_date off_sale_date);
  set have;&lt;BR /&gt;  retain group;&lt;BR /&gt;  by product;&lt;BR /&gt;  group=ifn(first.product,1,group+1);&lt;BR /&gt;  do date=on_sale_date to off_sale_date;
    output;
  end;
run;&lt;/PRE&gt;
&lt;P&gt;Then sort out your data from there, taking start of range/end of range.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2019 12:35:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Range-selection-based-of-lowest-price/m-p/543506#M150252</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2019-03-15T12:35:18Z</dc:date>
    </item>
    <item>
      <title>Re: Range selection based of lowest price</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Range-selection-based-of-lowest-price/m-p/543508#M150254</link>
      <description>&lt;P&gt;Not very specific for SQL, datastep is good for me.Let me check and confirm&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2019 12:36:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Range-selection-based-of-lowest-price/m-p/543508#M150254</guid>
      <dc:creator>Srigyan</dc:creator>
      <dc:date>2019-03-15T12:36:52Z</dc:date>
    </item>
    <item>
      <title>Re: Range selection based of lowest price</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Range-selection-based-of-lowest-price/m-p/543515#M150258</link>
      <description>&lt;P&gt;Its giving me day wise result and I specifically mentioned i dont want to go in that route. I need range without creating a day wise record.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2019 13:08:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Range-selection-based-of-lowest-price/m-p/543515#M150258</guid>
      <dc:creator>Srigyan</dc:creator>
      <dc:date>2019-03-15T13:08:05Z</dc:date>
    </item>
    <item>
      <title>Re: Range selection based of lowest price</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Range-selection-based-of-lowest-price/m-p/543516#M150259</link>
      <description>&lt;P&gt;Once you have the day-wise result, you can convert it into ranges.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But I doubt there's a way to get the result you want without first getting the day-wise results.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2019 13:15:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Range-selection-based-of-lowest-price/m-p/543516#M150259</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-03-15T13:15:43Z</dc:date>
    </item>
    <item>
      <title>Re: Range selection based of lowest price</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Range-selection-based-of-lowest-price/m-p/543537#M150267</link>
      <description>&lt;P&gt;Well, as I said, your going to have to do some work on the data.&amp;nbsp; Simplest method is daywise I am afraid.&amp;nbsp; You could look at hash lookups, not my style of coding so I tend to avoid that.&amp;nbsp; And you would have to loop over the data to find each match, then keep min/max of start/ends and values, then output again.&amp;nbsp; Not sure if it would save you anything and would be more complex coding.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrcon/65287/HTML/default/viewer.htm#n1b4cbtmb049xtn1vh9x4waiioz4.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrcon/65287/HTML/default/viewer.htm#n1b4cbtmb049xtn1vh9x4waiioz4.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2019 13:46:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Range-selection-based-of-lowest-price/m-p/543537#M150267</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2019-03-15T13:46:34Z</dc:date>
    </item>
    <item>
      <title>Re: Range selection based of lowest price</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Range-selection-based-of-lowest-price/m-p/543544#M150268</link>
      <description>&lt;P&gt;Daywise data i have created, but the challenge is to create the data the way i am looking.&lt;/P&gt;&lt;P&gt;Purpose to use less hard-disk, i have limited storage for this operation.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2019 14:11:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Range-selection-based-of-lowest-price/m-p/543544#M150268</guid>
      <dc:creator>Srigyan</dc:creator>
      <dc:date>2019-03-15T14:11:19Z</dc:date>
    </item>
    <item>
      <title>Re: Range selection based of lowest price</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Range-selection-based-of-lowest-price/m-p/543545#M150269</link>
      <description>&lt;P&gt;Daywise data i have created, but the challenge is to create the data the way i am looking.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Purpose to use less hard-disk, i have limited storage for this operation.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2019 14:11:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Range-selection-based-of-lowest-price/m-p/543545#M150269</guid>
      <dc:creator>Srigyan</dc:creator>
      <dc:date>2019-03-15T14:11:39Z</dc:date>
    </item>
    <item>
      <title>Re: Range selection based of lowest price</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Range-selection-based-of-lowest-price/m-p/543550#M150272</link>
      <description>&lt;P&gt;So you have lots and lots of RAM available then?&amp;nbsp; You need something in order to process it, be it disk space or ram.&amp;nbsp; If you have lots of ram then look at the hash method.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2019 14:23:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Range-selection-based-of-lowest-price/m-p/543550#M150272</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2019-03-15T14:23:10Z</dc:date>
    </item>
    <item>
      <title>Re: Range selection based of lowest price</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Range-selection-based-of-lowest-price/m-p/543553#M150275</link>
      <description>&lt;P&gt;I can try, please share how can i do it.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2019 14:28:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Range-selection-based-of-lowest-price/m-p/543553#M150275</guid>
      <dc:creator>Srigyan</dc:creator>
      <dc:date>2019-03-15T14:28:35Z</dc:date>
    </item>
    <item>
      <title>Re: Range selection based of lowest price</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Range-selection-based-of-lowest-price/m-p/543556#M150276</link>
      <description>&lt;P&gt;Please see the link provided on how to use the hash object:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrcon/65287/HTML/default/viewer.htm#n1b4cbtmb049xtn1vh9x4waiioz4.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrcon/65287/HTML/default/viewer.htm#n1b4cbtmb049xtn1vh9x4waiioz4.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2019 14:31:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Range-selection-based-of-lowest-price/m-p/543556#M150276</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2019-03-15T14:31:22Z</dc:date>
    </item>
    <item>
      <title>Re: Range selection based of lowest price</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Range-selection-based-of-lowest-price/m-p/543559#M150278</link>
      <description>Couldn't follow much of the discussion....but this is a simple coding exercise for proc sql.  It may take a while to run on 300GB of data...but you would have to process that data anyway to get the results you want.&lt;BR /&gt;&lt;BR /&gt;Proc sql noprint;&lt;BR /&gt;create table want as&lt;BR /&gt;select&lt;BR /&gt;  product,&lt;BR /&gt;  on_sale_date,&lt;BR /&gt;  off_sale_date,&lt;BR /&gt;  min(Price) as Price&lt;BR /&gt;from have&lt;BR /&gt;group by &lt;BR /&gt;  product,&lt;BR /&gt;  on_sale_date,&lt;BR /&gt;  off_sale_date&lt;BR /&gt;;&lt;BR /&gt;quit;</description>
      <pubDate>Fri, 15 Mar 2019 14:37:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Range-selection-based-of-lowest-price/m-p/543559#M150278</guid>
      <dc:creator>DBailey</dc:creator>
      <dc:date>2019-03-15T14:37:17Z</dc:date>
    </item>
    <item>
      <title>Re: Range selection based of lowest price</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Range-selection-based-of-lowest-price/m-p/543574#M150286</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/200312"&gt;@Srigyan&lt;/a&gt;, first of all, this clearly has some relation to your thread from yesterday&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Programming/range-change/m-p/543361#M150201" target="_self"&gt;&lt;SPAN&gt;range change&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;. I have provided a hash object solution that may suit this problem as well with a few twists. If your found your answer to that question, please mark one of them as a solution &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Secondly, I am not quite sure about the logic in this question. Can you be a little more specific? Why does product A go from having 6 observations to 3? And what determines the ranges? Eg, why not from the 2nd to the 8th in the second observation in your output data?&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2019 15:14:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Range-selection-based-of-lowest-price/m-p/543574#M150286</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-03-15T15:14:37Z</dc:date>
    </item>
    <item>
      <title>Re: Range selection based of lowest price</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Range-selection-based-of-lowest-price/m-p/543580#M150290</link>
      <description>&lt;P&gt;it has the business relationship &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; but thats not the same technically.&lt;/P&gt;&lt;P&gt;I still need to try all the answer given in my previous post. if that work surelly i will confirm that, sorry for delay.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As far as this problem is concern. and why the record is coming from 6 to 3 record for product A.&lt;/P&gt;&lt;P&gt;if you expand that data you have multiple price for same day but we need to consider only one price for one day which is the lowest. and thats why there are only 3 range which cover the entire period here. Hope thats clears the query.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2019 15:54:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Range-selection-based-of-lowest-price/m-p/543580#M150290</guid>
      <dc:creator>Srigyan</dc:creator>
      <dc:date>2019-03-15T15:54:51Z</dc:date>
    </item>
    <item>
      <title>Re: Range selection based of lowest price</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Range-selection-based-of-lowest-price/m-p/543581#M150291</link>
      <description>&lt;P&gt;request you to please have a look on the query.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2019 15:56:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Range-selection-based-of-lowest-price/m-p/543581#M150291</guid>
      <dc:creator>Srigyan</dc:creator>
      <dc:date>2019-03-15T15:56:51Z</dc:date>
    </item>
    <item>
      <title>Re: Range selection based of lowest price</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Range-selection-based-of-lowest-price/m-p/543582#M150292</link>
      <description>&lt;P&gt;I don't understand what you're asking me to do.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2019 16:00:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Range-selection-based-of-lowest-price/m-p/543582#M150292</guid>
      <dc:creator>DBailey</dc:creator>
      <dc:date>2019-03-15T16:00:30Z</dc:date>
    </item>
    <item>
      <title>Re: Range selection based of lowest price</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Range-selection-based-of-lowest-price/m-p/543676#M150306</link>
      <description>&lt;P&gt;See if this comes close:&lt;/P&gt;
&lt;PRE&gt;data have;
input Product $ on_sale_date :date9. off_sale_date :date9. Price ;
format on_sale_date off_sale_date date9.;
datalines;
A 01-Jan-18 07-Jan-18 28 
A 02-Jan-18 08-Jan-18 26 
A 02-Jan-18 07-Jan-18 28 
A 04-Jan-18 10-Jan-18 21 
A 02-Jan-18 10-Jan-18 10 
A 05-Jan-18 14-Jan-18 14 
b 02-Jan-18 09-Jan-18 27 
b 05-Jan-18 13-Jan-18 30 
b 04-Jan-18 12-Jan-18 16 
b 05-Jan-18 11-Jan-18 19 
c 02-Jan-18 08-Jan-18 27 
c 02-Jan-18 06-Jan-18 24 
c 02-Jan-18 08-Jan-18 30 
;
run;
data inter (drop=on_sale_date off_sale_date);
  set have;
  by product;
  do date=on_sale_date to off_sale_date;
    output;
  end;
  format date date9.;
run;

proc summary data=inter nway;
   class product date;
   var price;
   output out=summary (drop=_:) min=;
run;

proc summary data=summary nway;
   by product notsorted price;
   var date;
   output out=want (drop=_:) min=New_On_sale_date max=New_Off_sale_date;
run;&lt;/PRE&gt;
&lt;P&gt;Please provide example data in the form of a data step. Instructions here: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt; will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may need to ensure that you Product codes are consistent case in the data. If you have "b" and "B" and they are supposed to be the same product then the code can't tell that. Similar if you have minor spelling differences.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This will NOT interpolate an missing dates at the end of an interval. If there is no interval in the original data that includes Dec 25 &lt;STRONG&gt;and&lt;/STRONG&gt; the price on Dec 26 was different than on Dec 24 the result will not have any value for Dec 25 in any interval for new_on_sale_date or new_off_sale_date. If you have date intervals with gaps but the price was the same on both such as in&lt;/P&gt;
&lt;PRE&gt;A 02-Jan-18 10-Jan-18 10 
A 05-Jan-18 14-Jan-18 14 
A 18-Jan-18 28-Jan-18 14 
&lt;/PRE&gt;
&lt;P&gt;the result for the price 14 interval would be 11Jan2018 to&amp;nbsp; 28Jan2018. If you don't want that behavior we need more explicit rules.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2019 22:32:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Range-selection-based-of-lowest-price/m-p/543676#M150306</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-03-15T22:32:56Z</dc:date>
    </item>
    <item>
      <title>Re: Range selection based of lowest price</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Range-selection-based-of-lowest-price/m-p/543680#M150307</link>
      <description>&lt;P&gt;Ok. Makes sense &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your only reason to not create&amp;nbsp;&lt;SPAN&gt;day-wise results first is to save disk space, consider using the code provided by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt; and create a view instead of an actual data set like this&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data inter (drop=on_sale_date off_sale_date) / view=inter;
  set have;
  by product;
  do date=on_sale_date to off_sale_date;
    output;
  end;
  format date date9.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;If that for some reason is not enough, I would consider a hash object approach.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2019 23:19:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Range-selection-based-of-lowest-price/m-p/543680#M150307</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-03-15T23:19:20Z</dc:date>
    </item>
    <item>
      <title>Re: Range selection based of lowest price</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Range-selection-based-of-lowest-price/m-p/543721#M150317</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/200312"&gt;@Srigyan&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Daywise data i have created, but the challenge is to create the data the way i am looking.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Purpose to use less hard-disk, i have limited storage for this operation.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Use less hard disk? That should have been mentioned right at the beginning.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But somehow, you have to have enough space on either the disk or in memory to hold all your data and then sort it. If you don't have enough space, then you can't complete the task, it's not a programming problem any more, it is a hardware limitation.&lt;/P&gt;</description>
      <pubDate>Sat, 16 Mar 2019 11:43:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Range-selection-based-of-lowest-price/m-p/543721#M150317</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-03-16T11:43:05Z</dc:date>
    </item>
    <item>
      <title>Re: Range selection based of lowest price</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Range-selection-based-of-lowest-price/m-p/543921#M150373</link>
      <description>&lt;P&gt;Thanks for putting effor on my query and thats good learning for me.&lt;/P&gt;&lt;P&gt;However for my question the first condition was we can't create a date wise data.&lt;/P&gt;&lt;PRE&gt;data inter (drop=on_sale_date off_sale_date);
  set have;
  by product;
  do date=on_sale_date to off_sale_date;
    output;
  end;
  format date date9.;
run;&lt;/PRE&gt;&lt;P&gt;This section of code actually creating that, offcourse this is the right answer but not the one I am looking for.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Mar 2019 09:53:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Range-selection-based-of-lowest-price/m-p/543921#M150373</guid>
      <dc:creator>Srigyan</dc:creator>
      <dc:date>2019-03-18T09:53:30Z</dc:date>
    </item>
  </channel>
</rss>

