<?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: Summerising Data in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Summerising-Data/m-p/663717#M22804</link>
    <description>thanks a lot!!!!! i get it!!!! finally i done my last question for my assignment!!! you are really my angel!!! May God bless you!!</description>
    <pubDate>Sat, 20 Jun 2020 16:05:05 GMT</pubDate>
    <dc:creator>SOOKHUI99</dc:creator>
    <dc:date>2020-06-20T16:05:05Z</dc:date>
    <item>
      <title>Summerising Data</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Summerising-Data/m-p/663705#M22799</link>
      <description>&lt;P&gt;My question is to identify the buyer with the smallest and largest total number of item purchase. First I need to sum up the total unit purchase for each same buyer name as the name is repeated. I decided to use proc means but unfortunately, I can't get the output. So what should I do so that I can sum up and get the highest and lowest no of purchase?&amp;nbsp;&lt;STRONG&gt;REMARK: I'm using SAS 9.4&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot (80).png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/46410i927B58866DCCB2D5/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot (80).png" alt="Screenshot (80).png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I decided to get the result like this. But the sample syntax in the following picture does not work.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot (81).png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/46412i90780ED3A6AE3854/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot (81).png" alt="Screenshot (81).png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 20 Jun 2020 14:32:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Summerising-Data/m-p/663705#M22799</guid>
      <dc:creator>SOOKHUI99</dc:creator>
      <dc:date>2020-06-20T14:32:42Z</dc:date>
    </item>
    <item>
      <title>Re: Summerising Data</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Summerising-Data/m-p/663706#M22800</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/334582"&gt;@SOOKHUI99&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please supply data in a usable form (DATALINES in a DATA step).&lt;/P&gt;
&lt;P&gt;Could you please try the following code and see whether it does meet your needs?&lt;/P&gt;
&lt;P&gt;The MEANS Procedure output a dataset names 'Want' from the input dataset 'Have' : it contains one observation per buyer with the total price (= sum price*units)&lt;/P&gt;
&lt;P&gt;The PROC SQL output a report which select the buyer with the minimal amount and the buyer with the maximal amount.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;best,&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc means data=have noprint nway;
	class Buyer_Name;
	var price;
	weight unit;
	output out=want (drop=_:) sum=sum_purchase;
run;

proc sql;
	select *
	from want
	having sum_purchase= min(sum_purchase) or sum_purchase=max(sum_purchase);
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 20 Jun 2020 14:54:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Summerising-Data/m-p/663706#M22800</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-06-20T14:54:36Z</dc:date>
    </item>
    <item>
      <title>Re: Summerising Data</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Summerising-Data/m-p/663712#M22802</link>
      <description>&lt;P&gt;Hi! thanks a lot!! Finally I get the answer. But I got modified a bit. One more thing, want can i do if i want to add the word 'largest' and 'smallest' beside the buyer name or sum purchase. thanks again!!!&lt;/P&gt;&lt;P&gt;data have;&lt;BR /&gt;set foodsalesreport6;&lt;BR /&gt;run ;&lt;BR /&gt;proc means data=have noprint nway;&lt;BR /&gt;class Buyer_Name;&lt;BR /&gt;var unit;&lt;BR /&gt;output out=want (drop=_:) sum=sum_purchase;&lt;BR /&gt;run;&lt;BR /&gt;proc sql;&lt;BR /&gt;select *&lt;BR /&gt;from want&lt;BR /&gt;having sum_purchase= min(sum_purchase) or sum_purchase=max(sum_purchase);&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot (83).png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/46414iA54EDC27BBD7E4A2/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot (83).png" alt="Screenshot (83).png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 20 Jun 2020 15:43:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Summerising-Data/m-p/663712#M22802</guid>
      <dc:creator>SOOKHUI99</dc:creator>
      <dc:date>2020-06-20T15:43:06Z</dc:date>
    </item>
    <item>
      <title>Re: Summerising Data</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Summerising-Data/m-p/663715#M22803</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/334582"&gt;@SOOKHUI99&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can simply modify the PROC SQL as follows:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
	select "Smallest", *
	from want
	having sum_purchase= min(sum_purchase)
	
	union 
	
	select "Largest", *
	from want
	having sum_purchase= max(sum_purchase);
	
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Best,&lt;/P&gt;</description>
      <pubDate>Sat, 20 Jun 2020 15:58:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Summerising-Data/m-p/663715#M22803</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-06-20T15:58:42Z</dc:date>
    </item>
    <item>
      <title>Re: Summerising Data</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Summerising-Data/m-p/663717#M22804</link>
      <description>thanks a lot!!!!! i get it!!!! finally i done my last question for my assignment!!! you are really my angel!!! May God bless you!!</description>
      <pubDate>Sat, 20 Jun 2020 16:05:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Summerising-Data/m-p/663717#M22804</guid>
      <dc:creator>SOOKHUI99</dc:creator>
      <dc:date>2020-06-20T16:05:05Z</dc:date>
    </item>
    <item>
      <title>Re: Summerising Data</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Summerising-Data/m-p/663718#M22805</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/334582"&gt;@SOOKHUI99&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You're very welcome !&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 20 Jun 2020 16:07:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Summerising-Data/m-p/663718#M22805</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-06-20T16:07:16Z</dc:date>
    </item>
  </channel>
</rss>

