<?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: Adding numbers separated by a comma in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Adding-numbers-separated-by-a-comma/m-p/565518#M11191</link>
    <description>&lt;P&gt;So you have a string containing numbers, right? See this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input year dividend $;
datalines;
2010 10
2011 11,15
2012 16
2013 20
;

data want;
set have;
do i = 1 to countw(dividend,',');
  div_num = sum(div_num,input(scan(dividend,i,','),best32.));
end;
drop i;
run;

proc print data=want noobs;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;PRE&gt;year    dividend    div_num

2010     10            10  
2011     11,15         26  
2012     16            16  
2013     20            20  
&lt;/PRE&gt;</description>
    <pubDate>Wed, 12 Jun 2019 11:46:55 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2019-06-12T11:46:55Z</dc:date>
    <item>
      <title>Adding numbers separated by a comma</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Adding-numbers-separated-by-a-comma/m-p/565517#M11190</link>
      <description>&lt;P&gt;Hi guys,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please help me in adding up two numbers which are separated by a comma:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Year dividend&lt;/P&gt;&lt;P&gt;2010 10&lt;/P&gt;&lt;P&gt;2011 11,15&lt;/P&gt;&lt;P&gt;2012 16&lt;/P&gt;&lt;P&gt;2013 20&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the example, I want to take the total of 11 and 15 as my final amount for the year 2011.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Amanjot&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 11:42:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Adding-numbers-separated-by-a-comma/m-p/565517#M11190</guid>
      <dc:creator>amanjot_42</dc:creator>
      <dc:date>2019-06-12T11:42:32Z</dc:date>
    </item>
    <item>
      <title>Re: Adding numbers separated by a comma</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Adding-numbers-separated-by-a-comma/m-p/565518#M11191</link>
      <description>&lt;P&gt;So you have a string containing numbers, right? See this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input year dividend $;
datalines;
2010 10
2011 11,15
2012 16
2013 20
;

data want;
set have;
do i = 1 to countw(dividend,',');
  div_num = sum(div_num,input(scan(dividend,i,','),best32.));
end;
drop i;
run;

proc print data=want noobs;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;PRE&gt;year    dividend    div_num

2010     10            10  
2011     11,15         26  
2012     16            16  
2013     20            20  
&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Jun 2019 11:46:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Adding-numbers-separated-by-a-comma/m-p/565518#M11191</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-06-12T11:46:55Z</dc:date>
    </item>
    <item>
      <title>Re: Adding numbers separated by a comma</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Adding-numbers-separated-by-a-comma/m-p/565520#M11192</link>
      <description>&lt;P&gt;Thanks, that was so quick!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It worked well&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;cheers&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 11:57:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Adding-numbers-separated-by-a-comma/m-p/565520#M11192</guid>
      <dc:creator>amanjot_42</dc:creator>
      <dc:date>2019-06-12T11:57:17Z</dc:date>
    </item>
    <item>
      <title>Re: Adding numbers separated by a comma</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Adding-numbers-separated-by-a-comma/m-p/565521#M11193</link>
      <description>Thanks, that was so quick!&lt;BR /&gt;</description>
      <pubDate>Wed, 12 Jun 2019 11:57:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Adding-numbers-separated-by-a-comma/m-p/565521#M11193</guid>
      <dc:creator>amanjot_42</dc:creator>
      <dc:date>2019-06-12T11:57:17Z</dc:date>
    </item>
  </channel>
</rss>

