<?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 sum character variables horizontally ? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-sum-character-variables-horizontally/m-p/716166#M221289</link>
    <description>Thank you &lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;</description>
    <pubDate>Tue, 02 Feb 2021 18:32:55 GMT</pubDate>
    <dc:creator>Minku</dc:creator>
    <dc:date>2021-02-02T18:32:55Z</dc:date>
    <item>
      <title>How to sum character variables horizontally ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-sum-character-variables-horizontally/m-p/716147#M221281</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a dataset like below . For this , I want to create a new variable called 'Total' in this I want to sum the&amp;nbsp;&lt;/P&gt;&lt;P&gt;values only 'Correct ' and 'Yes' from Col1-Col6&amp;nbsp; horizontally by each&amp;nbsp; subjid ,&amp;nbsp;visit&amp;nbsp; and drug wise .Please respond , if you know how to perform this operation ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;subjid&amp;nbsp; visit&amp;nbsp; drug&amp;nbsp; col1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; col2&amp;nbsp; &amp;nbsp; &amp;nbsp;col3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;col4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;col5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; col6&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;STRONG&gt;Total&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;101&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; A&amp;nbsp; &amp;nbsp; &amp;nbsp;Correct&amp;nbsp; &amp;nbsp; &amp;nbsp;Yes&amp;nbsp; &amp;nbsp; &amp;nbsp;Incorrect&amp;nbsp; &amp;nbsp; Correct&amp;nbsp; &amp;nbsp; &amp;nbsp;Correct&amp;nbsp; &amp;nbsp; No&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;STRONG&gt;4&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;101&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; A&amp;nbsp; &amp;nbsp; &amp;nbsp;Incorrect&amp;nbsp; &amp;nbsp;Yes&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Correct&amp;nbsp; &amp;nbsp; &amp;nbsp;No&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Correct&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;STRONG&gt;3&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;101&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; B&amp;nbsp; &amp;nbsp; Correct&amp;nbsp; &amp;nbsp; &amp;nbsp; No&amp;nbsp; &amp;nbsp; Correct&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Correct&amp;nbsp; &amp;nbsp; &amp;nbsp;Yes&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Correct&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;STRONG&gt;5&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;101&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; B&amp;nbsp; &amp;nbsp; Correct&amp;nbsp; &amp;nbsp; &amp;nbsp; Yes&amp;nbsp; &amp;nbsp; Correct&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Yes&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Incorrect&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;STRONG&gt;4&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;101&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&amp;nbsp; &amp;nbsp; &amp;nbsp; A&amp;nbsp; &amp;nbsp; &amp;nbsp;Correct&amp;nbsp; &amp;nbsp; &amp;nbsp;Yes&amp;nbsp; &amp;nbsp; &amp;nbsp;Incorrect&amp;nbsp; &amp;nbsp; Correct&amp;nbsp; &amp;nbsp; &amp;nbsp;Yes&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Correct&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;STRONG&gt;5&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;101&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&amp;nbsp; &amp;nbsp; &amp;nbsp; A&amp;nbsp; &amp;nbsp; &amp;nbsp;Incorrect&amp;nbsp; &amp;nbsp;Yes&amp;nbsp; &amp;nbsp; Correct&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Correct&amp;nbsp; &amp;nbsp; &amp;nbsp;No&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Correct&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;STRONG&gt;4&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;101&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&amp;nbsp; &amp;nbsp; &amp;nbsp; B&amp;nbsp; &amp;nbsp; Correct&amp;nbsp; &amp;nbsp; &amp;nbsp; No&amp;nbsp; &amp;nbsp; Correct&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Correct&amp;nbsp; &amp;nbsp; &amp;nbsp;Yes&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Correct&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;STRONG&gt;5&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;101&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&amp;nbsp; &amp;nbsp; &amp;nbsp; B&amp;nbsp; &amp;nbsp; Correct&amp;nbsp; &amp;nbsp; &amp;nbsp; Yes&amp;nbsp; &amp;nbsp; Correct&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Yes&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Incorrect&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;STRONG&gt;4&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Feb 2021 17:24:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-sum-character-variables-horizontally/m-p/716147#M221281</guid>
      <dc:creator>Minku</dc:creator>
      <dc:date>2021-02-02T17:24:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to sum character variables horizontally ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-sum-character-variables-horizontally/m-p/716149#M221282</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set have;
    array c col1-col6;
    total=0;
    do i=1 to 6;
        if c(i)='Correct' or c(i)='Yes' then total=total+1;
    end;
    drop i;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 02 Feb 2021 17:32:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-sum-character-variables-horizontally/m-p/716149#M221282</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-02-02T17:32:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to sum character variables horizontally ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-sum-character-variables-horizontally/m-p/716166#M221289</link>
      <description>Thank you &lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;</description>
      <pubDate>Tue, 02 Feb 2021 18:32:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-sum-character-variables-horizontally/m-p/716166#M221289</guid>
      <dc:creator>Minku</dc:creator>
      <dc:date>2021-02-02T18:32:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to sum character variables horizontally ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-sum-character-variables-horizontally/m-p/855328#M338079</link>
      <description>i have a similar issue, but I am not able to solve it. Under each column (for me col1 is week1 of eahc year from 91 to 2021) i have many different values (could be more than a hundred), How do I make a count of each of the different values across all my columns?</description>
      <pubDate>Tue, 24 Jan 2023 14:29:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-sum-character-variables-horizontally/m-p/855328#M338079</guid>
      <dc:creator>bbkkku</dc:creator>
      <dc:date>2023-01-24T14:29:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to sum character variables horizontally ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-sum-character-variables-horizontally/m-p/855340#M338080</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/438762"&gt;@bbkkku&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You should start your own thread. As author of a thread you have some advantages and responses do not get confused with the requirements of the original poster of this thread.&lt;/P&gt;
&lt;P&gt;Provide a small example of data in the form of a data step and what you expect as a result for that example. Or reference one of the SAS supplied example data sets in the SASHELP library like the Sashelp.class data set. That set is very small and easy to make manual example output by examination if needed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One question to answer is are you expecting the result in a data set or a report that people will read?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc freq might be the answer as you would be counting. "Sum" only applies to numeric variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you have a SAS data set? The text you are using: " Under each column (for me col1 is week1 of eahc year from 91 to 2021) i have many different values" makes it sound like you are thinking of a spreadsheet and SAS works a bit differently.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jan 2023 15:26:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-sum-character-variables-horizontally/m-p/855340#M338080</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-01-24T15:26:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to sum character variables horizontally ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-sum-character-variables-horizontally/m-p/855341#M338081</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/438762"&gt;@bbkkku&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please start a new thread on this, and also provide an example of the data you war working with (you can just show us a few columns, we don't need to see all of them) and some example of the desired output.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jan 2023 15:26:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-sum-character-variables-horizontally/m-p/855341#M338081</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-01-24T15:26:33Z</dc:date>
    </item>
  </channel>
</rss>

