<?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: Changing null value in query calculated column to different value in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Changing-null-value-in-query-calculated-column-to-different/m-p/231291#M16802</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/58441"&gt;@kannand﻿&lt;/a&gt;&amp;nbsp;solution is easier :).&lt;/P&gt;
&lt;P&gt;And SAS, SAS SQL supports the coalesce function. Process is the same, create a computed column with&lt;/P&gt;
&lt;P&gt;Coalesce(var_value, 'NA')&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 23 Oct 2015 00:53:31 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2015-10-23T00:53:31Z</dc:date>
    <item>
      <title>Changing null value in query calculated column to different value</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Changing-null-value-in-query-calculated-column-to-different/m-p/231283#M16799</link>
      <description>&lt;P&gt;Greetings All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm running a query in where one set of data has a list of zip codes for members, and I have another file which has a list of zip codes and their corresponding region. The second file is used to map the regions for each zip code. However the first file has some zip codes that do not have a region for, thus when I run the query, I get the '.' value indicating this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to tell the query that when a match isn't there, instead of giving me '.' , I would rather it fill in the cell with 'NA' instead. I have tried using is null and is missing, but I keep getting a query error, stating that the 'when' statement does not match the requirements.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using SAS EG 7.1 and OS Windows 7, thank you.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Oct 2015 00:04:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Changing-null-value-in-query-calculated-column-to-different/m-p/231283#M16799</guid>
      <dc:creator>Nobuko42</dc:creator>
      <dc:date>2015-10-23T00:04:18Z</dc:date>
    </item>
    <item>
      <title>Re: Changing null value in query calculated column to different value</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Changing-null-value-in-query-calculated-column-to-different/m-p/231288#M16800</link>
      <description>Create a computed column and use a CASE statement to create the conditional variable. &lt;BR /&gt;&lt;BR /&gt;CASE when not missing(new_value) then new_value&lt;BR /&gt;else 'NA'</description>
      <pubDate>Fri, 23 Oct 2015 00:48:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Changing-null-value-in-query-calculated-column-to-different/m-p/231288#M16800</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-10-23T00:48:34Z</dc:date>
    </item>
    <item>
      <title>Re: Changing null value in query calculated column to different value</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Changing-null-value-in-query-calculated-column-to-different/m-p/231289#M16801</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I noticed that you mentioned "Query". &amp;nbsp;I am not familiar with EG 7 environment. However, in case of a SQL, I would recommend using COALESCE function that will exactly do what you need. &amp;nbsp; There should be something similar available on EG 7 or may be the same function is available.... worth looking up...&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you like to see details with examples for COALESCE (), here you go:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://msdn.microsoft.com/en-us/library/ms190349.aspx" target="_blank"&gt;https://msdn.microsoft.com/en-us/library/ms190349.aspx&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps... Good Luck...!!!&lt;/P&gt;</description>
      <pubDate>Fri, 23 Oct 2015 00:51:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Changing-null-value-in-query-calculated-column-to-different/m-p/231289#M16801</guid>
      <dc:creator>kannand</dc:creator>
      <dc:date>2015-10-23T00:51:44Z</dc:date>
    </item>
    <item>
      <title>Re: Changing null value in query calculated column to different value</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Changing-null-value-in-query-calculated-column-to-different/m-p/231291#M16802</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/58441"&gt;@kannand﻿&lt;/a&gt;&amp;nbsp;solution is easier :).&lt;/P&gt;
&lt;P&gt;And SAS, SAS SQL supports the coalesce function. Process is the same, create a computed column with&lt;/P&gt;
&lt;P&gt;Coalesce(var_value, 'NA')&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Oct 2015 00:53:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Changing-null-value-in-query-calculated-column-to-different/m-p/231291#M16802</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-10-23T00:53:31Z</dc:date>
    </item>
    <item>
      <title>Re: Changing null value in query calculated column to different value</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Changing-null-value-in-query-calculated-column-to-different/m-p/231383#M16808</link>
      <description>&lt;P&gt;Thank you all for the responses, the&amp;nbsp;&lt;SPAN&gt;Coalesce function did exactly what I needed but I have one other issue, which is what I think what was given me trouble. The variable is considered a number, thus if I try to change it to 'NA' I get an error saying it doesn't match, I'm assuming I have to change my variable into a string. How would I go about doing that, so that I can use the Coalesce to give out an NA value?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Oct 2015 16:19:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Changing-null-value-in-query-calculated-column-to-different/m-p/231383#M16808</guid>
      <dc:creator>Nobuko42</dc:creator>
      <dc:date>2015-10-23T16:19:20Z</dc:date>
    </item>
    <item>
      <title>Re: Changing null value in query calculated column to different value</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Changing-null-value-in-query-calculated-column-to-different/m-p/231393#M16810</link>
      <description>Hi, &lt;BR /&gt;Here is a code that you may try. .... There might be alternatives but this is simple to understand using basic SAS code.... The second record has the missing value next to the date. &lt;BR /&gt; &lt;BR /&gt;data have;infile datalines dlm='09'x;&lt;BR /&gt;input F_Date:yymmdd8. Analyst_Code;&lt;BR /&gt;datalines;&lt;BR /&gt;20010305 5&lt;BR /&gt;20011228 &lt;BR /&gt;20020223 7&lt;BR /&gt;20020518 5&lt;BR /&gt;20020826 7&lt;BR /&gt;20021001 9&lt;BR /&gt;;RUN;&lt;BR /&gt;DATA HAVE; SET HAVE;&lt;BR /&gt;LENGTH ANALYST_CODE_C $5.;&lt;BR /&gt;IF analyst_code = '.' &lt;BR /&gt;then analyst_code_C = 'NA';&lt;BR /&gt;ELSE ANALYST_CODE_C = PUT(ANALYST_CODE,$5.);&lt;BR /&gt;run;&lt;BR /&gt;proc sql;&lt;BR /&gt;select f_date, ANALYST_CODE_C From have;&lt;BR /&gt;quit;&lt;BR /&gt; &lt;BR /&gt;Here are the results:&lt;BR /&gt; &lt;BR /&gt;F_Date	ANALYST_CODE_C&lt;BR /&gt;15039	5&lt;BR /&gt;15337	NA&lt;BR /&gt;15394	7&lt;BR /&gt;15478	5&lt;BR /&gt;15578	7&lt;BR /&gt;15614	9&lt;BR /&gt; &lt;BR /&gt;Good Luck...!!!</description>
      <pubDate>Fri, 23 Oct 2015 16:56:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Changing-null-value-in-query-calculated-column-to-different/m-p/231393#M16810</guid>
      <dc:creator>kannand</dc:creator>
      <dc:date>2015-10-23T16:56:05Z</dc:date>
    </item>
    <item>
      <title>Re: Changing null value in query calculated column to different value</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Changing-null-value-in-query-calculated-column-to-different/m-p/231404#M16811</link>
      <description>Change your function to COALESCEC&lt;BR /&gt;&lt;BR /&gt;COALESCEC(PUT(VAR_VALUE, 8.), 'NA')</description>
      <pubDate>Fri, 23 Oct 2015 17:27:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Changing-null-value-in-query-calculated-column-to-different/m-p/231404#M16811</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-10-23T17:27:20Z</dc:date>
    </item>
    <item>
      <title>Re: Changing null value in query calculated column to different value</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Changing-null-value-in-query-calculated-column-to-different/m-p/231411#M16812</link>
      <description>&lt;P&gt;Or create a custom format to display missing numeric as NA (or other text);&lt;/P&gt;
&lt;P&gt;Proc format;&lt;/P&gt;
&lt;P&gt;value Na;&lt;/P&gt;
&lt;P&gt;. = 'NA';&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;And associate that format with the variable. You don't have to change a data type, if you do calculations on the variable it is still treated as missing, and you need not make another pass through the data at all.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Oct 2015 17:42:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Changing-null-value-in-query-calculated-column-to-different/m-p/231411#M16812</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-10-23T17:42:20Z</dc:date>
    </item>
    <item>
      <title>Re: Changing null value in query calculated column to different value</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Changing-null-value-in-query-calculated-column-to-different/m-p/231416#M16813</link>
      <description>&lt;P&gt;I've incorporated the format solution by &lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884" target="_self"&gt;ballardw&lt;/A&gt;&amp;nbsp;in the same example I stated earlier. &amp;nbsp;The format and SQL statement is what &amp;nbsp;you would need to focus.&lt;/P&gt;
&lt;P&gt;data have;infile datalines dlm='09'x;&lt;BR /&gt;input F_Date:yymmdd8. Analyst_Code;&lt;BR /&gt;datalines;&lt;BR /&gt;20010305 5&lt;BR /&gt;20011228 &lt;BR /&gt;20020223 7&lt;BR /&gt;20020518 5&lt;BR /&gt;20020826 7&lt;BR /&gt;20021001 9&lt;BR /&gt;;RUN;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;Proc format;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;value Na&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;. = 'NA';&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;run;&lt;/FONT&gt;&lt;BR /&gt;proc sql;&lt;BR /&gt; select f_date,&lt;FONT color="#FF0000"&gt;analyst_code format=Na.&lt;/FONT&gt; from have;&lt;BR /&gt;Quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Oct 2015 17:59:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Changing-null-value-in-query-calculated-column-to-different/m-p/231416#M16813</guid>
      <dc:creator>kannand</dc:creator>
      <dc:date>2015-10-23T17:59:19Z</dc:date>
    </item>
    <item>
      <title>Re: Changing null value in query calculated column to different value</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Changing-null-value-in-query-calculated-column-to-different/m-p/231537#M16823</link>
      <description>&lt;P&gt;If using SAS EG and your data is in SAS then you could also create a format with your lookup data (zipcode, region). With EG you can do this in a "point and click" manner using "Tasks/Date/Create format from data set".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Define "N/A" for your "other" cases&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/637iE8A5A81469EAEEA2/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="Capture.PNG" title="Capture.PNG" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then either create a new variable using "put(zipcode,&amp;lt;format.&amp;gt;)" or simply apply your format directly to the zipcode.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 25 Oct 2015 09:33:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Changing-null-value-in-query-calculated-column-to-different/m-p/231537#M16823</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2015-10-25T09:33:01Z</dc:date>
    </item>
  </channel>
</rss>

