<?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: Handling Missing and Null Values in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Handling-Missing-and-Null-Values/m-p/914475#M360353</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/35763"&gt;@yabwon&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13674"&gt;@LinusH&lt;/a&gt;&amp;nbsp; Thank you for the comments/solution. How to tweak your code if I want to do this in native database like SQL Server or Oracle? I know that it's not a right forum but still please help me if possible.&lt;/P&gt;</description>
    <pubDate>Mon, 05 Feb 2024 09:56:32 GMT</pubDate>
    <dc:creator>Babloo</dc:creator>
    <dc:date>2024-02-05T09:56:32Z</dc:date>
    <item>
      <title>Handling Missing and Null Values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Handling-Missing-and-Null-Values/m-p/914464#M360349</link>
      <description>&lt;P&gt;May I know how to tweak/extend the following code to handle both the conditions at the same time? Both Zip and Zip_Pllus is character datatype.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to do this, catx('-',ZIP,ZIP_PLUS) only when ZIP and/or ZIP_PLUS is missing or NULL. Also I'd like to know what would be the alternative to Catx function which can be used in SQL?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;case when not missing(zip) then catx('-',ZIP,ZIP_PLUS) 
  else ' '
end as PRO_ZIP length=10&lt;/PRE&gt;</description>
      <pubDate>Mon, 05 Feb 2024 05:01:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Handling-Missing-and-Null-Values/m-p/914464#M360349</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2024-02-05T05:01:27Z</dc:date>
    </item>
    <item>
      <title>Re: Handling Missing and Null Values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Handling-Missing-and-Null-Values/m-p/914470#M360350</link>
      <description>Just and an OR conditin to your when clause.&lt;BR /&gt;catx ccan be replaced by the concetanaiton operator (||) in combinaiton with the trim function.</description>
      <pubDate>Mon, 05 Feb 2024 07:01:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Handling-Missing-and-Null-Values/m-p/914470#M360350</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2024-02-05T07:01:11Z</dc:date>
    </item>
    <item>
      <title>Re: Handling Missing and Null Values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Handling-Missing-and-Null-Values/m-p/914472#M360351</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
length ZIP ZIP_PLUS $ 1;
infile cards dlm="," missover;
input ZIP ZIP_PLUS;
cards;
 , 
a, 
 ,b
a,b
;
run;

proc sql;
  select
     ZIP 
    ,ZIP_PLUS
    ,IFC(cmiss(ZIP,ZIP_PLUS), " ", catx('-',ZIP,ZIP_PLUS)) as PRO_ZIP length=3
  from
    have
  ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2024 09:26:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Handling-Missing-and-Null-Values/m-p/914472#M360351</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2024-02-05T09:26:12Z</dc:date>
    </item>
    <item>
      <title>Re: Handling Missing and Null Values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Handling-Missing-and-Null-Values/m-p/914475#M360353</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/35763"&gt;@yabwon&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13674"&gt;@LinusH&lt;/a&gt;&amp;nbsp; Thank you for the comments/solution. How to tweak your code if I want to do this in native database like SQL Server or Oracle? I know that it's not a right forum but still please help me if possible.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2024 09:56:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Handling-Missing-and-Null-Values/m-p/914475#M360353</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2024-02-05T09:56:32Z</dc:date>
    </item>
    <item>
      <title>Re: Handling Missing and Null Values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Handling-Missing-and-Null-Values/m-p/914476#M360354</link>
      <description>&lt;P&gt;My best guess:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;select
   ZIP 
  ,ZIP_PLUS
  ,CASE WHEN data_base_function_for_checking_missings(ZIP) 
             OR
             data_base_function_for_checking_missings(ZIP_PLUS) then NULL
        ELSE function_for_strings_concatenation(ZIP,'-',ZIP_PLUS)) 
    END as PRO_ZIP
from
  have
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2024 10:08:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Handling-Missing-and-Null-Values/m-p/914476#M360354</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2024-02-05T10:08:11Z</dc:date>
    </item>
    <item>
      <title>Re: Handling Missing and Null Values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Handling-Missing-and-Null-Values/m-p/914478#M360355</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/35763"&gt;@yabwon&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13674"&gt;@LinusH&lt;/a&gt;&amp;nbsp; &amp;nbsp;can we do something like this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Coalesce(ZIP,'')||coalesce('-'||case when len(ZIP_PLUS)&amp;gt;0 then ZIP_PLUS else NULL end ,'')&lt;/PRE&gt;</description>
      <pubDate>Mon, 05 Feb 2024 10:14:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Handling-Missing-and-Null-Values/m-p/914478#M360355</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2024-02-05T10:14:20Z</dc:date>
    </item>
    <item>
      <title>Re: Handling Missing and Null Values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Handling-Missing-and-Null-Values/m-p/914479#M360356</link>
      <description>&lt;P&gt;Let me put it this way: &lt;STRONG&gt;&lt;A title="https://communities.sas.com/t5/SAS-Communities-Library/Maxims-of-Maximally-Efficient-SAS-Programmers/ta-p/352068/show-comments/false" href="https://communities.sas.com/t5/SAS-Communities-Library/Maxims-of-Maximally-Efficient-SAS-Programmers/ta-p/352068/show-comments/false" target="_self"&gt;Maxim 4&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2024 10:21:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Handling-Missing-and-Null-Values/m-p/914479#M360356</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2024-02-05T10:21:07Z</dc:date>
    </item>
    <item>
      <title>Re: Handling Missing and Null Values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Handling-Missing-and-Null-Values/m-p/914480#M360357</link>
      <description>&lt;P&gt;Not sure about your scope.&lt;/P&gt;
&lt;P&gt;if you want to write SQL native to external DBMS, use explicit SQL pass though.&lt;/P&gt;
&lt;P&gt;You can try yourself with different syntax to see if your query is sent down to database using implicit pass through, by using&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options sastrace=',,,d' sastraceloc=saslog msglevel=i nostsuffix;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Where is your data stored, and where are you storing your result?&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2024 10:45:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Handling-Missing-and-Null-Values/m-p/914480#M360357</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2024-02-05T10:45:07Z</dc:date>
    </item>
  </channel>
</rss>

