<?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 row totals using the array statement in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Adding-row-totals-using-the-array-statement/m-p/720263#M223112</link>
    <description>&lt;P&gt;If "missing observations" means an observation where all variables have missing values, then all you have to do is test that beforehand.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data Demo_DOSS_HighRiskMed4;
Set Demo_DOSS_HighRiskMed;
   array DOSS_POS (*) $712 DOSS_POSITIVE1-DOSS_POSITIVE712 ( 0 1);
   if n(of doss_pos[*])=0 then x1=.;
   else x1=whichc(1, of DOSS_POS[*]);
   put x1=; 
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 18 Feb 2021 16:34:56 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2021-02-18T16:34:56Z</dc:date>
    <item>
      <title>Adding row totals using the array statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-row-totals-using-the-array-statement/m-p/720251#M223109</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please, I need help adding row totals using the array statement. The problem with my code is that where are&amp;nbsp; missing observations, it reports it as 0 instead of missing.&lt;/P&gt;
&lt;P&gt;I need help resolving this issue. Please, find below my codes&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data Demo_DOSS_HighRiskMed4;
Set Demo_DOSS_HighRiskMed;
   array DOSS_POS (*) $712 DOSS_POSITIVE1-DOSS_POSITIVE712 ( 0 1);
   x1=whichc(1, of DOSS_POS[*]);
   put x1=; 
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Thank you for your assistance.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 16:29:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-row-totals-using-the-array-statement/m-p/720251#M223109</guid>
      <dc:creator>UcheOkoro</dc:creator>
      <dc:date>2021-02-18T16:29:11Z</dc:date>
    </item>
    <item>
      <title>Re: Adding row totals using the array statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-row-totals-using-the-array-statement/m-p/720263#M223112</link>
      <description>&lt;P&gt;If "missing observations" means an observation where all variables have missing values, then all you have to do is test that beforehand.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data Demo_DOSS_HighRiskMed4;
Set Demo_DOSS_HighRiskMed;
   array DOSS_POS (*) $712 DOSS_POSITIVE1-DOSS_POSITIVE712 ( 0 1);
   if n(of doss_pos[*])=0 then x1=.;
   else x1=whichc(1, of DOSS_POS[*]);
   put x1=; 
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 16:34:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-row-totals-using-the-array-statement/m-p/720263#M223112</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-02-18T16:34:56Z</dc:date>
    </item>
    <item>
      <title>Re: Adding row totals using the array statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-row-totals-using-the-array-statement/m-p/720273#M223116</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/319831"&gt;@UcheOkoro&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please, I need help adding row totals using the array statement. The problem with my code is that where are&amp;nbsp; missing observations, it reports it as 0 instead of missing.&lt;/P&gt;
&lt;P&gt;I need help resolving this issue. Please, find below my codes&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data Demo_DOSS_HighRiskMed4;
Set Demo_DOSS_HighRiskMed;
   array DOSS_POS (*) $712 DOSS_POSITIVE1-DOSS_POSITIVE712 ( 0 1);
   x1=whichc(1, of DOSS_POS[*]);
   put x1=; 
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Thank you for your assistance.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Please note that you have NO test for "missing". The documentation for WHICHC, and WHICHN clearly state that if the value is not found that the function returns zero for a value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I bet you also have messages about "converting numeric to character" in your log. If the values are actually character 0 and 1 you should reference them as '0' and '1'.&lt;/P&gt;
&lt;P&gt;Do you actually have 712 variables each of 712 character length?&lt;/P&gt;
&lt;P&gt;If the variables you want to use already exist you do not need to provide a length or type.&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;array DOSS_POS (*)  DOSS_POSITIVE1-DOSS_POSITIVE712 ;&lt;/LI-CODE&gt;
&lt;P&gt;Should work just fine.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 17:27:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-row-totals-using-the-array-statement/m-p/720273#M223116</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-02-18T17:27:15Z</dc:date>
    </item>
  </channel>
</rss>

