<?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 sum of delhi and chandigarh only in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/sum-of-delhi-and-chandigarh-only/m-p/773264#M245617</link>
    <description>&lt;P&gt;data have;&lt;/P&gt;
&lt;P&gt;input state $ income;&lt;/P&gt;
&lt;P&gt;datalines;&lt;/P&gt;
&lt;P&gt;delhi&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1000&lt;/P&gt;
&lt;P&gt;delhi&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3000&lt;/P&gt;
&lt;P&gt;chandigarh&amp;nbsp; &amp;nbsp;4000&lt;/P&gt;
&lt;P&gt;chandigarh&amp;nbsp; &amp;nbsp;3000&lt;/P&gt;
&lt;P&gt;patna&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;300&lt;/P&gt;
&lt;P&gt;delhi&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;400&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;input state $ income;&lt;/P&gt;
&lt;P&gt;datalines;&lt;/P&gt;
&lt;P&gt;delhi&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;4400&lt;/P&gt;
&lt;P&gt;chandigarh&amp;nbsp; &amp;nbsp;7000&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
    <pubDate>Sun, 10 Oct 2021 11:57:38 GMT</pubDate>
    <dc:creator>aanan1417</dc:creator>
    <dc:date>2021-10-10T11:57:38Z</dc:date>
    <item>
      <title>sum of delhi and chandigarh only</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sum-of-delhi-and-chandigarh-only/m-p/773264#M245617</link>
      <description>&lt;P&gt;data have;&lt;/P&gt;
&lt;P&gt;input state $ income;&lt;/P&gt;
&lt;P&gt;datalines;&lt;/P&gt;
&lt;P&gt;delhi&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1000&lt;/P&gt;
&lt;P&gt;delhi&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3000&lt;/P&gt;
&lt;P&gt;chandigarh&amp;nbsp; &amp;nbsp;4000&lt;/P&gt;
&lt;P&gt;chandigarh&amp;nbsp; &amp;nbsp;3000&lt;/P&gt;
&lt;P&gt;patna&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;300&lt;/P&gt;
&lt;P&gt;delhi&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;400&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;input state $ income;&lt;/P&gt;
&lt;P&gt;datalines;&lt;/P&gt;
&lt;P&gt;delhi&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;4400&lt;/P&gt;
&lt;P&gt;chandigarh&amp;nbsp; &amp;nbsp;7000&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Sun, 10 Oct 2021 11:57:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sum-of-delhi-and-chandigarh-only/m-p/773264#M245617</guid>
      <dc:creator>aanan1417</dc:creator>
      <dc:date>2021-10-10T11:57:38Z</dc:date>
    </item>
    <item>
      <title>Re: sum of delhi and chandigarh only</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sum-of-delhi-and-chandigarh-only/m-p/773265#M245618</link>
      <description>&lt;P&gt;Use a where= dataset option:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc summary data=have (where=(state in ("...","...")));
by state;
var income;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 10 Oct 2021 13:19:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sum-of-delhi-and-chandigarh-only/m-p/773265#M245618</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-10-10T13:19:39Z</dc:date>
    </item>
    <item>
      <title>Re: sum of delhi and chandigarh only</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sum-of-delhi-and-chandigarh-only/m-p/773268#M245620</link>
      <description>&lt;P&gt;As written, the length of the &lt;STRONG&gt;state&lt;/STRONG&gt; variable in your &lt;STRONG&gt;have&lt;/STRONG&gt; and &lt;STRONG&gt;want&lt;/STRONG&gt; datasets will default to 8 - too small to hold all the values. Try this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
length state $ 10;
input state $ income;
datalines;
delhi             1000
delhi             3000
chandigarh   4000
chandigarh   3000
patna             300
delhi               400
;
run;

 

data want;
length state $ 10;
input state $ income;
datalines;
chandigarh   7000
delhi             4400
;

run;

proc sql;
/*create table want as */
select state, sum(income)
   from have
   where lowcase(state) in ('delhi','chandigarh')
   group by state
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;May the SAS be with you &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 10 Oct 2021 15:13:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sum-of-delhi-and-chandigarh-only/m-p/773268#M245620</guid>
      <dc:creator>SASJedi</dc:creator>
      <dc:date>2021-10-10T15:13:13Z</dc:date>
    </item>
  </channel>
</rss>

