<?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: How can I sum the input of lines of data in SAS? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-sum-the-input-of-lines-of-data-in-SAS/m-p/541278#M149419</link>
    <description>&lt;P&gt;&amp;nbsp;Why have you defined dice1 as character ($) and not numeric ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Don't you mean to sum:&amp;nbsp; dice1 + dice2 ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You should, first create a new variable wit the sum result, then in the next step run the graphic procedure.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA auto;
INPUT dice1  dice2;   /* both variables numeric */
   sum_dices = sum(dice1 dice2);
CARDS;
1 1
1 2
1 3
1 4
1 5
1 6
2 1
2 2
......
;
run;

proc sgplot data=auto;
  HBAR sum_dices;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 08 Mar 2019 01:49:21 GMT</pubDate>
    <dc:creator>Shmuel</dc:creator>
    <dc:date>2019-03-08T01:49:21Z</dc:date>
    <item>
      <title>How can I sum the input of lines of data in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-sum-the-input-of-lines-of-data-in-SAS/m-p/541277#M149418</link>
      <description>&lt;P&gt;I am trying to sum each line of data that I have below and create a histogram from the information, but I don't know how to approach this. For example, in line 1, I have the values 1 and 1 so I want to add 1+1 = 2, and then 1 + 2 = 3, and so on and so forth and then plot a histogram of the frequencies of each sum. I will appreciate any help with this. Thank you.&amp;nbsp;&lt;/P&gt;&lt;P&gt;EDIT: I updated the variables for both to be numeric, but I want the frequencies to be the frequency of each sum expressed as a percentage of the total. For example, the sum 2 only shows up once when you toss two dice, so the percentage is 1/36 or 2.78%. I tried to do sum_dices = sum(dice1, dice2)/36; but it just changed the x-axis labels without changing the data.&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA auto;&lt;BR /&gt;INPUT dice1 dice2;&lt;BR /&gt;sum_dices = sum(dice1, dice2);&lt;BR /&gt;CARDS;&lt;BR /&gt;1 1&lt;BR /&gt;1 2&lt;BR /&gt;1 3&lt;BR /&gt;1 4&lt;BR /&gt;1 5&lt;BR /&gt;1 6&lt;BR /&gt;2 1&lt;BR /&gt;2 2&lt;BR /&gt;2 3&lt;BR /&gt;2 4&lt;BR /&gt;2 5&lt;BR /&gt;2 6&lt;BR /&gt;3 1&lt;BR /&gt;3 2&lt;BR /&gt;3 3&lt;BR /&gt;3 4&lt;BR /&gt;3 5&lt;BR /&gt;3 6&lt;BR /&gt;4 1&lt;BR /&gt;4 2&lt;BR /&gt;4 3&lt;BR /&gt;4 4&lt;BR /&gt;4 5&lt;BR /&gt;4 6&lt;BR /&gt;5 1&lt;BR /&gt;5 2&lt;BR /&gt;5 3&lt;BR /&gt;5 4&lt;BR /&gt;5 5&lt;BR /&gt;5 6&lt;BR /&gt;6 1&lt;BR /&gt;6 2&lt;BR /&gt;6 3&lt;BR /&gt;6 4&lt;BR /&gt;6 5&lt;BR /&gt;6 6&lt;BR /&gt;;&lt;BR /&gt;proc sgplot data=auto;&lt;BR /&gt;VBAR sum_dices;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2019 03:13:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-sum-the-input-of-lines-of-data-in-SAS/m-p/541277#M149418</guid>
      <dc:creator>Fara_I</dc:creator>
      <dc:date>2019-03-08T03:13:47Z</dc:date>
    </item>
    <item>
      <title>Re: How can I sum the input of lines of data in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-sum-the-input-of-lines-of-data-in-SAS/m-p/541278#M149419</link>
      <description>&lt;P&gt;&amp;nbsp;Why have you defined dice1 as character ($) and not numeric ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Don't you mean to sum:&amp;nbsp; dice1 + dice2 ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You should, first create a new variable wit the sum result, then in the next step run the graphic procedure.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA auto;
INPUT dice1  dice2;   /* both variables numeric */
   sum_dices = sum(dice1 dice2);
CARDS;
1 1
1 2
1 3
1 4
1 5
1 6
2 1
2 2
......
;
run;

proc sgplot data=auto;
  HBAR sum_dices;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 08 Mar 2019 01:49:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-sum-the-input-of-lines-of-data-in-SAS/m-p/541278#M149419</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2019-03-08T01:49:21Z</dc:date>
    </item>
    <item>
      <title>How can I sum the input of lines of data in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-sum-the-input-of-lines-of-data-in-SAS/m-p/541281#M149420</link>
      <description>&lt;P&gt;Something like this?&lt;/P&gt;&lt;P&gt;Also one of the variables is defined as a character variable, howcome?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data WANT;
  set HAVE;
  call missing (TOTAL);
  TOTAL = sum(DICE1, DICE2);
run; 

proc sgplot data=WANT; 
  vbar TOTAL ; 
run; 
  &lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2019 01:59:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-sum-the-input-of-lines-of-data-in-SAS/m-p/541281#M149420</guid>
      <dc:creator>VRKiwi</dc:creator>
      <dc:date>2019-03-08T01:59:28Z</dc:date>
    </item>
    <item>
      <title>Re: How can I sum the input of lines of data in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-sum-the-input-of-lines-of-data-in-SAS/m-p/541303#M149429</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/261030"&gt;@VRKiwi&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Something like this?&lt;/P&gt;
&lt;P&gt;Also one of the variables is defined as a character variable, howcome?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data WANT;
  set HAVE;
  call missing (TOTAL);
  TOTAL = sum(DICE1, DICE2);
run; 

proc sgplot data=WANT; 
  vbar TOTAL ; 
run; 
  &lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You don't need to set a variable to missing before you use it. The variable will be set to missing automatically in each iteration of set statement.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2019 06:12:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-sum-the-input-of-lines-of-data-in-SAS/m-p/541303#M149429</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2019-03-08T06:12:00Z</dc:date>
    </item>
  </channel>
</rss>

