<?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 make PROC SQL count missing values? in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/How-to-make-PROC-SQL-count-missing-values/m-p/878711#M39003</link>
    <description>&lt;P&gt;Very elegant answer.&lt;/P&gt;&lt;P&gt;So, it appears and confirmed after testing, that count(var) does not count missing values of var.&lt;/P&gt;</description>
    <pubDate>Thu, 01 Jun 2023 16:26:34 GMT</pubDate>
    <dc:creator>Steve_SAS</dc:creator>
    <dc:date>2023-06-01T16:26:34Z</dc:date>
    <item>
      <title>How to make PROC SQL count missing values?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-make-PROC-SQL-count-missing-values/m-p/740906#M29095</link>
      <description>&lt;P&gt;Here's the scenario:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sample;
  input x;
datalines;
1
2
.
4
run;

proc sql;
  select count(*) from sample; /*returns 4*/
  select count(x) from sample; /*returns 3*/
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Is there a way to count that missing value for x?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a built in variable in proc sql that represents the total number of observations?&lt;/P&gt;</description>
      <pubDate>Wed, 12 May 2021 19:26:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-make-PROC-SQL-count-missing-values/m-p/740906#M29095</guid>
      <dc:creator>cosmid</dc:creator>
      <dc:date>2021-05-12T19:26:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to make PROC SQL count missing values?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-make-PROC-SQL-count-missing-values/m-p/740908#M29096</link>
      <description>&lt;P&gt;Use the NMISS function&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc sql;
  select nmiss(x) from sample; /*returns 1*/
quit;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 May 2021 19:27:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-make-PROC-SQL-count-missing-values/m-p/740908#M29096</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-05-12T19:27:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to make PROC SQL count missing values?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-make-PROC-SQL-count-missing-values/m-p/740913#M29097</link>
      <description>&lt;P&gt;Either just use subtraction:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
  select count(*) as N
       , count(x) as NX
       , count(*)-count(x) as MISSX
  from sample
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or SUM() a boolean expression. SAS evaluates boolean expressions to 1 or 0.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
  select count(*) as N
       , count(x) as NX
       , sum(missing(x)) as MISSX
  from sample
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 May 2021 19:36:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-make-PROC-SQL-count-missing-values/m-p/740913#M29097</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-05-12T19:36:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to make PROC SQL count missing values?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-make-PROC-SQL-count-missing-values/m-p/740915#M29098</link>
      <description>Wow! Thanks for the quick reply. I"m guessing there isn't a way to count a var that include its missing values? I thought there's something like a count_miss(x) that will return a 4:) Thanks for your help!</description>
      <pubDate>Wed, 12 May 2021 19:40:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-make-PROC-SQL-count-missing-values/m-p/740915#M29098</guid>
      <dc:creator>cosmid</dc:creator>
      <dc:date>2021-05-12T19:40:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to make PROC SQL count missing values?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-make-PROC-SQL-count-missing-values/m-p/740917#M29099</link>
      <description>Wow! Thanks for the quick reply. I"m guessing there isn't a way to count a var that include its missing values? I thought there's something like a count_miss(x) that will return a 4:) Thanks for your help!&lt;BR /&gt;&lt;BR /&gt;Sorry for duplicated messages. Would be nice if there's a reply to all:)</description>
      <pubDate>Wed, 12 May 2021 19:43:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-make-PROC-SQL-count-missing-values/m-p/740917#M29099</guid>
      <dc:creator>cosmid</dc:creator>
      <dc:date>2021-05-12T19:43:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to make PROC SQL count missing values?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-make-PROC-SQL-count-missing-values/m-p/878711#M39003</link>
      <description>&lt;P&gt;Very elegant answer.&lt;/P&gt;&lt;P&gt;So, it appears and confirmed after testing, that count(var) does not count missing values of var.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Jun 2023 16:26:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-make-PROC-SQL-count-missing-values/m-p/878711#M39003</guid>
      <dc:creator>Steve_SAS</dc:creator>
      <dc:date>2023-06-01T16:26:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to make PROC SQL count missing values?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-make-PROC-SQL-count-missing-values/m-p/878712#M39004</link>
      <description>nmiss(x) is the elegant answer.</description>
      <pubDate>Thu, 01 Jun 2023 16:27:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-make-PROC-SQL-count-missing-values/m-p/878712#M39004</guid>
      <dc:creator>Steve_SAS</dc:creator>
      <dc:date>2023-06-01T16:27:46Z</dc:date>
    </item>
  </channel>
</rss>

