<?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: find maximum day of the sale in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/find-maximum-day-of-the-sale/m-p/449600#M113165</link>
    <description>&lt;P&gt;this code not working may be we should used macro as date keep dynamic.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 29 Mar 2018 09:06:05 GMT</pubDate>
    <dc:creator>Raavi2507</dc:creator>
    <dc:date>2018-03-29T09:06:05Z</dc:date>
    <item>
      <title>find maximum day of the sale</title>
      <link>https://communities.sas.com/t5/SAS-Programming/find-maximum-day-of-the-sale/m-p/449579#M113158</link>
      <description>&lt;P&gt;How to find maximum sale day of the previous week according to the day the report is run. The date needs to be kept dynamic.&lt;/P&gt;&lt;P&gt;how i can solved this using attached dataset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Mar 2018 06:14:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/find-maximum-day-of-the-sale/m-p/449579#M113158</guid>
      <dc:creator>Raavi2507</dc:creator>
      <dc:date>2018-03-29T06:14:20Z</dc:date>
    </item>
    <item>
      <title>Re: find maximum day of the sale</title>
      <link>https://communities.sas.com/t5/SAS-Programming/find-maximum-day-of-the-sale/m-p/449581#M113160</link>
      <description>&lt;P&gt;A csv-file is not a dataset, so please post the code used to read the csv-file, so that we start with what you already have.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Mar 2018 06:33:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/find-maximum-day-of-the-sale/m-p/449581#M113160</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2018-03-29T06:33:25Z</dc:date>
    </item>
    <item>
      <title>Re: find maximum day of the sale</title>
      <link>https://communities.sas.com/t5/SAS-Programming/find-maximum-day-of-the-sale/m-p/449586#M113161</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile datalines dlm=',' dsd;
input InvoiceNo StockCode:$12. Description:$30. Quantity InvoiceDate:ANYDTDTE. UnitPrice:best12.2 CustomerID Country:$20.;
format InvoiceDate date9.;
datalines;
536365,85123A,WHITE HANGING HEART T-LIGHT HOLDER,6,01-12-10 8:26,2.55,17850,United Kingdom
536365,71053,WHITE METAL LANTERN,6,01-13-10 8:26,3.39,17850,United Kingdom
536365,84406B,CREAM CUPID HEARTS COAT HANGER,8,01-14-10 8:26,2.75,17850,United Kingdom
536365,84029G,KNITTED UNION FLAG HOT WATER BOTTLE,6,01-15-10 8:26,3.39,17850,United Kingdom
536365,84029E,RED WOOLLY HOTTIE WHITE HEART.,6,01-16-10 8:26,3.39,17850,United Kingdom
536365,22752,SET 7 BABUSHKA NESTING BOXES,2,01-17-10 8:26,7.65,17850,United Kingdom
536365,21730,GLASS STAR FROSTED T-LIGHT HOLDER,6,01-18-10 8:26,4.25,17850,United Kingdom
536366,22633,HAND WARMER UNION JACK,6,01-19-10 8:28,1.85,17850,United Kingdom
536366,22632,HAND WARMER RED POLKA DOT,6,01-20-10 8:28,1.85,17850,United Kingdom
536367,84879,ASSORTED COLOUR BIRD ORNAMENT,32,01-21-10 8:34,1.69,13047,United Kingdom
536367,22745,POPPY'S PLAYHOUSE BEDROOM ,6,01-22-10 8:34,2.1,13047,United Kingdom
536367,22748,POPPY'S PLAYHOUSE KITCHEN,6,01-23-10 8:34,2.1,13047,United Kingdom
536367,22749,FELTCRAFT PRINCESS CHARLOTTE DOLL,8,01-24-10 8:34,3.75,13047,United Kingdom
536367,22310,IVORY KNITTED MUG COSY ,6,01-25-10 8:34,1.65,13047,United Kingdom
536367,84969,BOX OF 6 ASSORTED COLOUR TEASPOONS,6,01-26-10 8:34,4.25,13047,United Kingdom
536367,22623,BOX OF VINTAGE JIGSAW BLOCKS ,3,01-27-10 8:34,4.95,13047,United Kingdom
536367,22622,BOX OF VINTAGE ALPHABET BLOCKS,2,01-28-10 8:34,9.95,13047,United Kingdom
536367,21754,HOME BUILDING BLOCK WORD,3,01-29-10 8:34,5.95,13047,United Kingdom
536367,21755,LOVE BUILDING BLOCK WORD,3,01-30-10 8:34,5.95,13047,United Kingdom
536367,21777,RECIPE BOX WITH METAL HEART,4,01-31-10 8:34,7.95,13047,United Kingdom
;
run;

proc sql;
create table want as
select *, (select max(InvoiceDate) from
										(select InvoiceDate from
																( select InvoiceDate,sum(UnitPrice) as _price from have 
																					where InvoiceDate between h.InvoiceDate-1 and h.InvoiceDate-8 
																					group by InvoiceDate
																)
											group by InvoiceDate having max(_price)
										)
			) format date9. as Last_week_max_sale
from have h;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This is a long file, please post small examples or sample input output, that way it becomes easy for us to solve an issue.&lt;/P&gt;&lt;P&gt;Please let us know if it helped.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Mar 2018 07:19:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/find-maximum-day-of-the-sale/m-p/449586#M113161</guid>
      <dc:creator>Satish_Parida</dc:creator>
      <dc:date>2018-03-29T07:19:37Z</dc:date>
    </item>
    <item>
      <title>Re: find maximum day of the sale</title>
      <link>https://communities.sas.com/t5/SAS-Programming/find-maximum-day-of-the-sale/m-p/449600#M113165</link>
      <description>&lt;P&gt;this code not working may be we should used macro as date keep dynamic.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Mar 2018 09:06:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/find-maximum-day-of-the-sale/m-p/449600#M113165</guid>
      <dc:creator>Raavi2507</dc:creator>
      <dc:date>2018-03-29T09:06:05Z</dc:date>
    </item>
    <item>
      <title>Re: find maximum day of the sale</title>
      <link>https://communities.sas.com/t5/SAS-Programming/find-maximum-day-of-the-sale/m-p/449602#M113167</link>
      <description>&lt;P&gt;Post your data &lt;EM&gt;as is&lt;/EM&gt;, and the code you have, and show where the results differ from your expectations. Then we can help you with code that fits your data and will work.&lt;/P&gt;
&lt;P&gt;You have been shown repeatedly how to post data.&lt;/P&gt;
&lt;P&gt;Without proper example data, it's all guesswork.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Mar 2018 09:11:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/find-maximum-day-of-the-sale/m-p/449602#M113167</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-03-29T09:11:46Z</dc:date>
    </item>
    <item>
      <title>Re: find maximum day of the sale</title>
      <link>https://communities.sas.com/t5/SAS-Programming/find-maximum-day-of-the-sale/m-p/449611#M113171</link>
      <description>&lt;P&gt;First, let's rule that out as a possibility.&amp;nbsp; If your code doesn't work, you can never turn it into a macro and hope that it now will work.&amp;nbsp; You need working code first.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You need to clarify what "previous week" means.&amp;nbsp; Seven days relative to the date you run the program?&amp;nbsp; (Would today's date be included or excluded?)&amp;nbsp; Seven days relative to the InvoiceDate?&amp;nbsp; (Again, would the invoice date be included or excluded?)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What identifies the observations you will consider?&amp;nbsp; For example, do you want all observations in the previous week?&amp;nbsp; All observations for the same customer?&lt;/P&gt;</description>
      <pubDate>Thu, 29 Mar 2018 11:03:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/find-maximum-day-of-the-sale/m-p/449611#M113171</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-03-29T11:03:26Z</dc:date>
    </item>
  </channel>
</rss>

