<?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 to find total in the last column in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-total-in-the-last-column/m-p/685752#M208027</link>
    <description>I think there is a big N that was left out, the percentages are based on total counts over big N( n=30). The counts should be add up to the total.  The first total for &amp;gt;=400 mg is 6(6/30) which is  6(20.0%) &lt;BR /&gt;Sorry for the confusion.</description>
    <pubDate>Tue, 22 Sep 2020 16:21:09 GMT</pubDate>
    <dc:creator>Amy0223</dc:creator>
    <dc:date>2020-09-22T16:21:09Z</dc:date>
    <item>
      <title>How to find total in the last column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-total-in-the-last-column/m-p/685563#M207938</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Could someone please advise how to get&amp;nbsp;the total in the last column? I really appreciate your kind help!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2020-09-21 at 9.50.00 PM.png" style="width: 490px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/49624iACCA7AE75C973899/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2020-09-21 at 9.50.00 PM.png" alt="Screen Shot 2020-09-21 at 9.50.00 PM.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Sep 2020 02:57:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-total-in-the-last-column/m-p/685563#M207938</guid>
      <dc:creator>Amy0223</dc:creator>
      <dc:date>2020-09-22T02:57:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to find total in the last column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-total-in-the-last-column/m-p/685570#M207941</link>
      <description>&lt;P&gt;Is that Excel?&amp;nbsp; If that is Excel, it might be better to post this question on an Excel forum.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have an underlying SAS dataset, please post the first dozen or so rows of data.&amp;nbsp; If you have a SAS program that is producing the Excel spreadsheet, please post the source code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Tue, 22 Sep 2020 03:30:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-total-in-the-last-column/m-p/685570#M207941</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2020-09-22T03:30:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to find total in the last column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-total-in-the-last-column/m-p/685708#M208006</link>
      <description>This is SAS but I just wanted to show what the SAS output might looks like using Excel. Sorry, I don't have the source code. The row number should start as 1 from above xx mg. It's row 1 to 7 only. Any suggestions is greatly appreciated.</description>
      <pubDate>Tue, 22 Sep 2020 14:20:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-total-in-the-last-column/m-p/685708#M208006</guid>
      <dc:creator>Amy0223</dc:creator>
      <dc:date>2020-09-22T14:20:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to find total in the last column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-total-in-the-last-column/m-p/685711#M208008</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/265801"&gt;@Amy0223&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Could someone please advise how to get&amp;nbsp;the total in the last column? I really appreciate your kind help!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2020-09-21 at 9.50.00 PM.png" style="width: 490px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/49624iACCA7AE75C973899/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2020-09-21 at 9.50.00 PM.png" alt="Screen Shot 2020-09-21 at 9.50.00 PM.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I'm afraid the request to compute a TOTAL doesn't make any sense here. You have text strings in a2, a3, &lt;EM&gt;etc&lt;/EM&gt;. How could you add the text strings "1(50.0%)" + "1(50.0%) + "1(20.3%)" + ... ??? Please explain further what should go into the TOTAL column.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your SAS data set really (as shown) contains text strings like "1(50.0%)", this is a particularly poor way to represent and store data for the purposes of creating a total (or for any other purpose I can think of)&lt;/P&gt;</description>
      <pubDate>Tue, 22 Sep 2020 14:36:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-total-in-the-last-column/m-p/685711#M208008</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-09-22T14:36:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to find total in the last column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-total-in-the-last-column/m-p/685726#M208017</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data new;
set old;
array temp a2 a3 a4 a5 a6;
array temp_n(5) ;
total=0;
do i = 1 to dim(temp);
if index(temp[i],'(') &amp;gt; 0 then do;

&amp;nbsp; &amp;nbsp;total+=input(scan(scan(temp[i],2,'('),-1,')'),percent4.2);

end;

else do;

&amp;nbsp; total+= 0;

end;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;As Paige suggested the format is not correct for columns a2 a3 etc.. However hope the above helps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Sep 2020 15:05:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-total-in-the-last-column/m-p/685726#M208017</guid>
      <dc:creator>smantha</dc:creator>
      <dc:date>2020-09-22T15:05:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to find total in the last column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-total-in-the-last-column/m-p/685737#M208021</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/265801"&gt;@Amy0223&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Could someone please advise how to get&amp;nbsp;the total in the last column? I really appreciate your kind help!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2020-09-21 at 9.50.00 PM.png" style="width: 490px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/49624iACCA7AE75C973899/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2020-09-21 at 9.50.00 PM.png" alt="Screen Shot 2020-09-21 at 9.50.00 PM.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Just what would that "total" actually look like for the example values? Summing the percentages for A2 through A6 sounds most likely to be way off.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Sep 2020 15:34:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-total-in-the-last-column/m-p/685737#M208021</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-09-22T15:34:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to find total in the last column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-total-in-the-last-column/m-p/685748#M208024</link>
      <description>The total includes total counts and percentages for A2 through A6. Thank you!</description>
      <pubDate>Tue, 22 Sep 2020 16:08:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-total-in-the-last-column/m-p/685748#M208024</guid>
      <dc:creator>Amy0223</dc:creator>
      <dc:date>2020-09-22T16:08:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to find total in the last column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-total-in-the-last-column/m-p/685749#M208025</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/265801"&gt;@Amy0223&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;The total includes total counts and percentages for A2 through A6. Thank you!&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Just add the counts and the percentages? Does that make any sense? I don't think so, you can't add percentages, it won't make any sense, if I am understanding the numbers.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you show us what you want by filling in the cells with the desired values?&lt;/P&gt;</description>
      <pubDate>Tue, 22 Sep 2020 16:11:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-total-in-the-last-column/m-p/685749#M208025</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-09-22T16:11:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to find total in the last column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-total-in-the-last-column/m-p/685752#M208027</link>
      <description>I think there is a big N that was left out, the percentages are based on total counts over big N( n=30). The counts should be add up to the total.  The first total for &amp;gt;=400 mg is 6(6/30) which is  6(20.0%) &lt;BR /&gt;Sorry for the confusion.</description>
      <pubDate>Tue, 22 Sep 2020 16:21:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-total-in-the-last-column/m-p/685752#M208027</guid>
      <dc:creator>Amy0223</dc:creator>
      <dc:date>2020-09-22T16:21:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to find total in the last column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-total-in-the-last-column/m-p/685757#M208028</link>
      <description>&lt;P&gt;Before we waste any more time spinning fairy tales, post an example for your source dataset in usable form (data step with datalines), so we can be sure about types, content and formats, and have something to test code against. Post your code in a code box. Also show us the numbers you want to get out of that example data.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Sep 2020 16:34:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-total-in-the-last-column/m-p/685757#M208028</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-09-22T16:34:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to find total in the last column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-total-in-the-last-column/m-p/685759#M208029</link>
      <description>&lt;P&gt;&amp;nbsp;As stated above, you have picked a very poor way to store the data, making it actually harder to get the results you want. You have to pull apart character strings, change the resulting character strings to numeric, and then add. Nevertheless, here is some UNTESTED code for you, since we can't work from screen captures (if you want tested code, we'd need the actual data as a &lt;A href="https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/" target="_self"&gt;SAS data step&lt;/A&gt;).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set have;
    array a{*} a2-a6;
    total=0;
    do i=1 to dim(a);
        total = sum(total, input(scan(a(i),1,'('),2.));
    end;
    total=total/30;
    drop i;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If the above code works, please don't simply say it works and leave. Please take to heart the advice you have been given not to store numbers in complicated text strings, so that next time you are in this situation, the process of addition is much simpler.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Sep 2020 16:40:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-total-in-the-last-column/m-p/685759#M208029</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-09-22T16:40:47Z</dc:date>
    </item>
  </channel>
</rss>

