<?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 Number of missing Char values in row in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Number-of-missing-Char-values-in-row/m-p/959769#M374438</link>
    <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I want to calculate number of numeric missing&amp;nbsp; values&amp;nbsp; in each row.&lt;/P&gt;
&lt;P&gt;I want to calculate number of Char missing&amp;nbsp; values&amp;nbsp; in each row.&lt;/P&gt;
&lt;P&gt;Why the char missing values is not calculated correctly??&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data my_data;
input team $ points assists rebounds;
cards;
A 10 2 .
A 17 5 .
A 17 . .
A 18 3 4
A 15 0 5
B . 4 5
B 29 0 8
B . 2 9
C 12 1 9
. 30 1 .
;
run;

data want;
set my_data;
nr_Numeric_Missing_Values=nmiss(of _numeric_)-1;
nr_CHAR_Missing_Values=nmiss(of _character_)-1;
Run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 20 Feb 2025 15:00:51 GMT</pubDate>
    <dc:creator>Ronein</dc:creator>
    <dc:date>2025-02-20T15:00:51Z</dc:date>
    <item>
      <title>Number of missing Char values in row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Number-of-missing-Char-values-in-row/m-p/959769#M374438</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I want to calculate number of numeric missing&amp;nbsp; values&amp;nbsp; in each row.&lt;/P&gt;
&lt;P&gt;I want to calculate number of Char missing&amp;nbsp; values&amp;nbsp; in each row.&lt;/P&gt;
&lt;P&gt;Why the char missing values is not calculated correctly??&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data my_data;
input team $ points assists rebounds;
cards;
A 10 2 .
A 17 5 .
A 17 . .
A 18 3 4
A 15 0 5
B . 4 5
B 29 0 8
B . 2 9
C 12 1 9
. 30 1 .
;
run;

data want;
set my_data;
nr_Numeric_Missing_Values=nmiss(of _numeric_)-1;
nr_CHAR_Missing_Values=nmiss(of _character_)-1;
Run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 20 Feb 2025 15:00:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Number-of-missing-Char-values-in-row/m-p/959769#M374438</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2025-02-20T15:00:51Z</dc:date>
    </item>
    <item>
      <title>Re: umber of Char missing  values  in  row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Number-of-missing-Char-values-in-row/m-p/959770#M374439</link>
      <description>&lt;P&gt;I'm not sure why you're subtracting 1 from these.&amp;nbsp; For one thing, both of the variables you're creating are numeric, so I don't see a reason to subtract 1 from the count of character missing values.&amp;nbsp; Second, neither of these two new variables would have missing values in the first place, so they wouldn't be contributing to the count of missing values.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Oh, also, you need to use cmiss() for the 2nd one.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Feb 2025 11:47:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Number-of-missing-Char-values-in-row/m-p/959770#M374439</guid>
      <dc:creator>quickbluefish</dc:creator>
      <dc:date>2025-02-20T11:47:56Z</dc:date>
    </item>
    <item>
      <title>Re: umber of Char missing  values  in  row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Number-of-missing-Char-values-in-row/m-p/959771#M374440</link>
      <description>&lt;P&gt;Why are you using nmiss to calculate nr_CHAR_Missing_Values?&lt;/P&gt;
&lt;P&gt;Why are you subtracting 1 from the result?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Feb 2025 11:45:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Number-of-missing-Char-values-in-row/m-p/959771#M374440</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2025-02-20T11:45:30Z</dc:date>
    </item>
    <item>
      <title>Re: umber of Char missing  values  in  row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Number-of-missing-Char-values-in-row/m-p/959772#M374441</link>
      <description>&lt;P&gt;The NMISS function is used to count numeric missing values only. It does not work for character variables.&lt;/P&gt;
&lt;P&gt;CMISS works for both numeric and character variables.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you use the cmiss instead of nmiss function then your code will execute without errors but it will return -1 for&amp;nbsp;nr_CHAR_Missing_Values.&lt;/P&gt;
&lt;P&gt;The answers you've got &lt;A href="https://communities.sas.com/t5/SAS-Programming/number-missing-values-in-each-obs-Numeric/m-p/959766#M374435" target="_self"&gt;here&lt;/A&gt;&amp;nbsp;explain why you need to subtract 1. ...and now ask yourself of what datatype&amp;nbsp;nr_CHAR_Missing_Values is and you should understand how to fix your code.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Feb 2025 11:59:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Number-of-missing-Char-values-in-row/m-p/959772#M374441</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2025-02-20T11:59:42Z</dc:date>
    </item>
    <item>
      <title>Re: umber of Char missing  values  in  row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Number-of-missing-Char-values-in-row/m-p/959776#M374442</link>
      <description>Oh, interesting - because the numeric count variable is initially missing itself.  Got it.</description>
      <pubDate>Thu, 20 Feb 2025 12:04:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Number-of-missing-Char-values-in-row/m-p/959776#M374442</guid>
      <dc:creator>quickbluefish</dc:creator>
      <dc:date>2025-02-20T12:04:55Z</dc:date>
    </item>
    <item>
      <title>Re: umber of Char missing  values  in  row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Number-of-missing-Char-values-in-row/m-p/959799#M374449</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/223320"&gt;@quickbluefish&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Oh, interesting - because the numeric count variable is initially missing itself. Got it.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Or in this case numeric count variable&lt;U&gt;&lt;STRONG&gt;s&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Feb 2025 17:10:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Number-of-missing-Char-values-in-row/m-p/959799#M374449</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2025-02-20T17:10:09Z</dc:date>
    </item>
    <item>
      <title>Re: Number of missing Char values in row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Number-of-missing-Char-values-in-row/m-p/959880#M374476</link>
      <description>&lt;P&gt;Because NMISS() is only worked for NUMERIC type variable, NOT CHARACTER type variable.&lt;/P&gt;
&lt;P&gt;If you want to take into account of both of them , switch into&amp;nbsp; CMISS().&lt;/P&gt;
&lt;PRE&gt;data my_data;
input team $ points assists rebounds;
cards;
A 10 2 .
A 17 5 .
A 17 . .
A 18 3 4
A 15 0 5
B . 4 5
B 29 0 8
B . 2 9
C 12 1 9
. 30 1 .
;
run;

data want;
set my_data;
&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;nr_Numeric_Missing_Values=0;
nr_CHAR_Missing_Values=0;&lt;/STRONG&gt;&lt;/FONT&gt;
nr_Numeric_Missing_Values=&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;cmiss&lt;/STRONG&gt;&lt;/FONT&gt;(of _numeric_);
nr_CHAR_Missing_Values=&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;cmiss&lt;/STRONG&gt;&lt;/FONT&gt;(of _character_);
Run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Feb 2025 02:31:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Number-of-missing-Char-values-in-row/m-p/959880#M374476</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2025-02-21T02:31:19Z</dc:date>
    </item>
  </channel>
</rss>

