<?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 CASE WHEN Column1 = '.' in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/CASE-WHEN-Column1/m-p/881125#M43180</link>
    <description>&lt;P&gt;Dear team,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Column 1 consists of numeric values and also missing ones assigned just with one dot '.'.&lt;/P&gt;&lt;P&gt;I would like to create a new column with the outcome depending if Column1 numeric or '.'.&lt;/P&gt;&lt;P&gt;Below is the simplified code using PROC SQL:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;case&lt;BR /&gt;when Column1 = '.'&lt;BR /&gt;then 3&lt;BR /&gt;else 4&amp;nbsp;&lt;BR /&gt;end&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The next error appears "ERROR: Expression using equals (=) has components that are of different data types.".&lt;/P&gt;&lt;P&gt;I also tried to use IFN function,&amp;nbsp;IFN (Column1 = '.', 3, 4) It gives the same ERROR.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone assist please?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Fri, 16 Jun 2023 15:21:24 GMT</pubDate>
    <dc:creator>Stepik</dc:creator>
    <dc:date>2023-06-16T15:21:24Z</dc:date>
    <item>
      <title>CASE WHEN Column1 = '.'</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/CASE-WHEN-Column1/m-p/881125#M43180</link>
      <description>&lt;P&gt;Dear team,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Column 1 consists of numeric values and also missing ones assigned just with one dot '.'.&lt;/P&gt;&lt;P&gt;I would like to create a new column with the outcome depending if Column1 numeric or '.'.&lt;/P&gt;&lt;P&gt;Below is the simplified code using PROC SQL:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;case&lt;BR /&gt;when Column1 = '.'&lt;BR /&gt;then 3&lt;BR /&gt;else 4&amp;nbsp;&lt;BR /&gt;end&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The next error appears "ERROR: Expression using equals (=) has components that are of different data types.".&lt;/P&gt;&lt;P&gt;I also tried to use IFN function,&amp;nbsp;IFN (Column1 = '.', 3, 4) It gives the same ERROR.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone assist please?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2023 15:21:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/CASE-WHEN-Column1/m-p/881125#M43180</guid>
      <dc:creator>Stepik</dc:creator>
      <dc:date>2023-06-16T15:21:24Z</dc:date>
    </item>
    <item>
      <title>Re: CASE WHEN Column1 = '.'</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/CASE-WHEN-Column1/m-p/881127#M43181</link>
      <description>. is SAS notation for missing for numeric. So all values are numeric. &lt;BR /&gt;&lt;BR /&gt;This should work:&lt;BR /&gt;&lt;BR /&gt;case when missing(column1) then 3 else 4 end</description>
      <pubDate>Fri, 16 Jun 2023 15:34:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/CASE-WHEN-Column1/m-p/881127#M43181</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-06-16T15:34:50Z</dc:date>
    </item>
    <item>
      <title>Re: CASE WHEN Column1 = '.'</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/CASE-WHEN-Column1/m-p/881140#M43182</link>
      <description>&lt;P&gt;So the error message is say that the comparison operator&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Column1 = '.'&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;is trying to compare values of different TYPEs.&amp;nbsp; SAS only has two types.&amp;nbsp; Floating point numbers and fixed length character strings.&amp;nbsp; &amp;nbsp;Since the right side is clearly a character constant then COLUMN1 must be a NUMERIC variable.&amp;nbsp; So you need to compare it to a numeric value.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Column1 = .&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Which will test if column1 has normal missing value.&lt;/P&gt;
&lt;P&gt;If you want to test if COLUMN1 has other missing values, such as .A or .Z, then you could use the MISSING() function instead of the comparison operator.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;missing(Column1)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note that the MISSING() function will also work if COLUMN1 is character.&amp;nbsp; SAS will treat a character value that only contains spaces as missing.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2023 16:09:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/CASE-WHEN-Column1/m-p/881140#M43182</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-06-16T16:09:28Z</dc:date>
    </item>
    <item>
      <title>Re: CASE WHEN Column1 = '.'</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/CASE-WHEN-Column1/m-p/881357#M43186</link>
      <description>Tom, what would be the solution if I would like to use IFN (IFC) function?</description>
      <pubDate>Mon, 19 Jun 2023 08:42:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/CASE-WHEN-Column1/m-p/881357#M43186</guid>
      <dc:creator>Stepik</dc:creator>
      <dc:date>2023-06-19T08:42:03Z</dc:date>
    </item>
    <item>
      <title>Re: CASE WHEN Column1 = '.'</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/CASE-WHEN-Column1/m-p/881359#M43187</link>
      <description>&lt;P&gt;Same as has been discussed above, you use &lt;FONT face="courier new,courier"&gt;column1=.&lt;/FONT&gt; instead of &lt;FONT face="courier new,courier"&gt;column1='.'&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jun 2023 09:44:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/CASE-WHEN-Column1/m-p/881359#M43187</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-06-19T09:44:52Z</dc:date>
    </item>
  </channel>
</rss>

