<?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: NULL Values in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/NULL-Values/m-p/234975#M43007</link>
    <description>&lt;P&gt;SAS has two similar functions for this purpose: COALESCE for numeric arguments and COALESCEC for character arguments.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your function call "coalesce(gender_cd_'3')" is inconsistent as it uses a character argument, '3', with COALESCE. Is gender_cd a numeric or a character variable?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That said, I was not able to replicate your result if gender_cd has just a missing value: If I define it as a numeric variable, the PROC SQL step stops with "ERROR: The COALESCE function requires its arguments to be of the same data type." If I define it as a character variable, it is accepted and works fine in spite of using the "wrong" function. So, it would be interesting to see what gender_cd really contains in&amp;nbsp;the last but one observation.&lt;/P&gt;</description>
    <pubDate>Tue, 17 Nov 2015 09:12:33 GMT</pubDate>
    <dc:creator>FreelanceReinh</dc:creator>
    <dc:date>2015-11-17T09:12:33Z</dc:date>
    <item>
      <title>NULL Values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/NULL-Values/m-p/234969#M43005</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am new with SAS, I have very small question How to handle NULL values in SAS. In oracle we are using nvl for null so what is the function in SAS to handle null.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;libname mydblib oracle user='GAG' password='abcd123' path='prod2' schema='SALES';&lt;/P&gt;
&lt;P&gt;proc sql;&lt;BR /&gt;select distinct coalesce(gender_cd,'3') from mydblib.cust_addr;&lt;BR /&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="line-height: 20px;"&gt;COALESCE_TXT_1_GENDER_CD__3__&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;________________________&lt;BR /&gt; 1&lt;BR /&gt; 3&lt;BR /&gt; 6&lt;BR /&gt; 0&lt;BR /&gt; 8&lt;BR /&gt; 5&lt;BR /&gt; 7&lt;BR /&gt; 9&lt;BR /&gt; 4&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have null values in output. please suggest how to handle this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thaks in advance.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Nov 2015 07:59:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/NULL-Values/m-p/234969#M43005</guid>
      <dc:creator>CG1</dc:creator>
      <dc:date>2015-11-17T07:59:26Z</dc:date>
    </item>
    <item>
      <title>Re: NULL Values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/NULL-Values/m-p/234975#M43007</link>
      <description>&lt;P&gt;SAS has two similar functions for this purpose: COALESCE for numeric arguments and COALESCEC for character arguments.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your function call "coalesce(gender_cd_'3')" is inconsistent as it uses a character argument, '3', with COALESCE. Is gender_cd a numeric or a character variable?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That said, I was not able to replicate your result if gender_cd has just a missing value: If I define it as a numeric variable, the PROC SQL step stops with "ERROR: The COALESCE function requires its arguments to be of the same data type." If I define it as a character variable, it is accepted and works fine in spite of using the "wrong" function. So, it would be interesting to see what gender_cd really contains in&amp;nbsp;the last but one observation.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Nov 2015 09:12:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/NULL-Values/m-p/234975#M43007</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2015-11-17T09:12:33Z</dc:date>
    </item>
    <item>
      <title>Re: NULL Values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/NULL-Values/m-p/234979#M43009</link>
      <description>&lt;P&gt;The other option, &amp;nbsp;I'd like to suggest is that if it is a non numeric and non blank value, &amp;nbsp;check if the var contains anything other than a numeric value(0-9), initialize based on your needs. &amp;nbsp;I was thinking more of an invisible, &amp;nbsp;hexadecimal &amp;nbsp;value that is not visible. ..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Good luck. ..!!!&lt;/P&gt;</description>
      <pubDate>Tue, 17 Nov 2015 09:45:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/NULL-Values/m-p/234979#M43009</guid>
      <dc:creator>kannand</dc:creator>
      <dc:date>2015-11-17T09:45:29Z</dc:date>
    </item>
    <item>
      <title>Re: NULL Values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/NULL-Values/m-p/235010#M43019</link>
      <description>&lt;P&gt;You can use a missing function, this will work with character or numeric.&amp;nbsp; where missing(&lt;SPAN style="line-height: 20px;"&gt;COALESCE_TXT_1_GENDER_CD__3__);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 20px;"&gt;or &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 20px;"&gt;where not missing(COALESCE_TXT_1_GENDER_CD__3__);&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Nov 2015 13:48:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/NULL-Values/m-p/235010#M43019</guid>
      <dc:creator>Steelers_In_DC</dc:creator>
      <dc:date>2015-11-17T13:48:57Z</dc:date>
    </item>
    <item>
      <title>Re: NULL Values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/NULL-Values/m-p/235011#M43020</link>
      <description>&lt;P&gt;The value in your character variable is not a space, that is why the coalesce did not change it to a '3'.&lt;/P&gt;
&lt;P&gt;Use $HEX. format to display the hex code for the value that looks like a blank. &amp;nbsp;It is probably something like 'A0'X or '09'x or '0D'x.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Nov 2015 13:57:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/NULL-Values/m-p/235011#M43020</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-11-17T13:57:15Z</dc:date>
    </item>
    <item>
      <title>Re: NULL Values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/NULL-Values/m-p/235018#M43023</link>
      <description>&lt;P&gt;If you view the data in Notepad++ with the hexadecimal editor plug-in turned on, you'll be able to view the hex character you have and you can code for it or as I mentioned in my previous post above, &amp;nbsp;you can also check for any non numerics and code for it. &amp;nbsp;So you've got atleast 2 options.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Nov 2015 14:23:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/NULL-Values/m-p/235018#M43023</guid>
      <dc:creator>kannand</dc:creator>
      <dc:date>2015-11-17T14:23:52Z</dc:date>
    </item>
  </channel>
</rss>

