<?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 Proc sql to subtract numbers from another dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-sql-to-subtract-numbers-from-another-dataset/m-p/781844#M249187</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have two datasets that I need to sum by type (eg John) then minus a specific type (eg Sally) from dataset one to calculate a % without specific type Sally.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;data one;&lt;/STRONG&gt;&lt;BR /&gt;infile datalines delimiter=','; &lt;BR /&gt;input type $ number;&lt;BR /&gt;datalines; &lt;BR /&gt;John, 10&lt;BR /&gt;Peter, 22&lt;BR /&gt;Amy, 35&lt;BR /&gt;Sally, 34&lt;BR /&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;data two;&lt;/STRONG&gt;&lt;BR /&gt;infile datalines delimiter=','; &lt;BR /&gt;input type $ number;&lt;BR /&gt;datalines; &lt;BR /&gt;John, 1&lt;BR /&gt;Peter, 1&lt;BR /&gt;Amy, 2&lt;BR /&gt;Sally, 2&lt;BR /&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;proc sql;&lt;/STRONG&gt;&lt;BR /&gt;select&lt;BR /&gt;sum (John) as John1 label = "John" format=comma8.,&lt;BR /&gt;calculated John1/(select sum(number-sum(type='Sally')) from have2) label "John %" format=percent.&lt;/P&gt;
&lt;P&gt;from have1;&lt;BR /&gt;quit;&lt;/P&gt;</description>
    <pubDate>Tue, 23 Nov 2021 02:01:59 GMT</pubDate>
    <dc:creator>ywon111</dc:creator>
    <dc:date>2021-11-23T02:01:59Z</dc:date>
    <item>
      <title>Proc sql to subtract numbers from another dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-sql-to-subtract-numbers-from-another-dataset/m-p/781844#M249187</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have two datasets that I need to sum by type (eg John) then minus a specific type (eg Sally) from dataset one to calculate a % without specific type Sally.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;data one;&lt;/STRONG&gt;&lt;BR /&gt;infile datalines delimiter=','; &lt;BR /&gt;input type $ number;&lt;BR /&gt;datalines; &lt;BR /&gt;John, 10&lt;BR /&gt;Peter, 22&lt;BR /&gt;Amy, 35&lt;BR /&gt;Sally, 34&lt;BR /&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;data two;&lt;/STRONG&gt;&lt;BR /&gt;infile datalines delimiter=','; &lt;BR /&gt;input type $ number;&lt;BR /&gt;datalines; &lt;BR /&gt;John, 1&lt;BR /&gt;Peter, 1&lt;BR /&gt;Amy, 2&lt;BR /&gt;Sally, 2&lt;BR /&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;proc sql;&lt;/STRONG&gt;&lt;BR /&gt;select&lt;BR /&gt;sum (John) as John1 label = "John" format=comma8.,&lt;BR /&gt;calculated John1/(select sum(number-sum(type='Sally')) from have2) label "John %" format=percent.&lt;/P&gt;
&lt;P&gt;from have1;&lt;BR /&gt;quit;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Nov 2021 02:01:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-sql-to-subtract-numbers-from-another-dataset/m-p/781844#M249187</guid>
      <dc:creator>ywon111</dc:creator>
      <dc:date>2021-11-23T02:01:59Z</dc:date>
    </item>
    <item>
      <title>Re: Proc sql to subtract numbers from another dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-sql-to-subtract-numbers-from-another-dataset/m-p/781853#M249192</link>
      <description>&lt;P&gt;select sum(NUMBER*(TYPE='John' )) /&amp;nbsp;( sum(NUMBER) - sum(NUMBER*(TYPE='Sally' )) )&lt;/P&gt;</description>
      <pubDate>Tue, 23 Nov 2021 04:17:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-sql-to-subtract-numbers-from-another-dataset/m-p/781853#M249192</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-11-23T04:17:01Z</dc:date>
    </item>
  </channel>
</rss>

