<?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: Help with SAS PROC SQL errors in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Help-with-SAS-PROC-SQL-errors/m-p/803575#M316416</link>
    <description>&lt;P&gt;You have the following error message in your first example&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Expression using less than (&amp;lt;) has components that are of different data types.&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The only code I see with a&amp;nbsp; "&amp;lt;"&amp;nbsp; compares the variable age to a set of numeric values.&amp;nbsp; Which in turn suggests that age is being stored as a character value.&amp;nbsp; Check your proc contents of the data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As to the second error: The &lt;EM&gt;&lt;STRONG&gt;group by&lt;/STRONG&gt;&lt;/EM&gt;&amp;nbsp;clause should be part of the &lt;EM&gt;&lt;STRONG&gt;select&lt;/STRONG&gt;&lt;/EM&gt;&amp;nbsp;statement, but you separated the &lt;EM&gt;&lt;STRONG&gt;group by&lt;/STRONG&gt;&lt;/EM&gt; from the &lt;EM&gt;&lt;STRONG&gt;select&lt;/STRONG&gt;&lt;/EM&gt; with a semi-colon.&amp;nbsp; Remove it.&lt;/P&gt;</description>
    <pubDate>Wed, 23 Mar 2022 14:17:02 GMT</pubDate>
    <dc:creator>mkeintz</dc:creator>
    <dc:date>2022-03-23T14:17:02Z</dc:date>
    <item>
      <title>Help with SAS PROC SQL errors</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-with-SAS-PROC-SQL-errors/m-p/803572#M316414</link>
      <description>&lt;P&gt;&lt;BR /&gt;proc sql;&lt;BR /&gt;create table Brooking as&lt;BR /&gt;select count (CAGE),&lt;BR /&gt;case&lt;BR /&gt;when( age&amp;lt; 5) then 0&lt;BR /&gt;when( 5&amp;lt;=age&amp;lt;14) then 1&lt;BR /&gt;when(15&amp;lt;=age&amp;lt;24) then 2&lt;BR /&gt;when(25&amp;lt;=age&amp;lt;34) then 3&lt;BR /&gt;when(35&amp;lt;=age&amp;lt;44) then 4&lt;BR /&gt;when(45&amp;lt;=age&amp;lt;54) then 5&lt;BR /&gt;when(55&amp;lt;=age&amp;lt;64) then 6&lt;BR /&gt;when(65&amp;lt;=age&amp;lt;74) then 7&lt;BR /&gt;when(75&amp;lt;=age&amp;lt;84) then 8&lt;BR /&gt;when(85&amp;lt;=age) then 9&lt;BR /&gt;else .&lt;BR /&gt;end as age_group&lt;BR /&gt;from _EXP1_.death2020;&lt;BR /&gt;group by CRESIDZIP_EXT;&lt;BR /&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good morning!!!I tried using the code that was been helped with yesterday and this was the error coming out. I'm not sure why&lt;/P&gt;
&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Mjooda_0-1648044298299.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/69722i0D518A7A10FFEB71/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Mjooda_0-1648044298299.png" alt="Mjooda_0-1648044298299.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;but then if I use another data file, it brings out a table but also with an error. pls kindly help&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;BR /&gt;create table Brooking as&lt;BR /&gt;select count (CDATEOFBIRTH),&lt;BR /&gt;case&lt;BR /&gt;when( age&amp;lt; 5) then 0&lt;BR /&gt;when( 5&amp;lt;=age&amp;lt;14) then 1&lt;BR /&gt;when(15&amp;lt;=age&amp;lt;24) then 2&lt;BR /&gt;when(25&amp;lt;=age&amp;lt;34) then 3&lt;BR /&gt;when(35&amp;lt;=age&amp;lt;44) then 4&lt;BR /&gt;when(45&amp;lt;=age&amp;lt;54) then 5&lt;BR /&gt;when(55&amp;lt;=age&amp;lt;64) then 6&lt;BR /&gt;when(65&amp;lt;=age&amp;lt;74) then 7&lt;BR /&gt;when(75&amp;lt;=age&amp;lt;84) then 8&lt;BR /&gt;when(85&amp;lt;=age) then 9&lt;BR /&gt;else '9'&lt;BR /&gt;end as CDATEOFBIRTH&lt;BR /&gt;from _EXP0_.dt2015final;&lt;BR /&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Mjooda_1-1648044454956.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/69723iCC1C50C8101EFAF7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Mjooda_1-1648044454956.png" alt="Mjooda_1-1648044454956.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Mar 2022 14:12:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-with-SAS-PROC-SQL-errors/m-p/803572#M316414</guid>
      <dc:creator>Mjooda</dc:creator>
      <dc:date>2022-03-23T14:12:30Z</dc:date>
    </item>
    <item>
      <title>Re: Help with SAS PROC SQL errors</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-with-SAS-PROC-SQL-errors/m-p/803575#M316416</link>
      <description>&lt;P&gt;You have the following error message in your first example&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Expression using less than (&amp;lt;) has components that are of different data types.&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The only code I see with a&amp;nbsp; "&amp;lt;"&amp;nbsp; compares the variable age to a set of numeric values.&amp;nbsp; Which in turn suggests that age is being stored as a character value.&amp;nbsp; Check your proc contents of the data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As to the second error: The &lt;EM&gt;&lt;STRONG&gt;group by&lt;/STRONG&gt;&lt;/EM&gt;&amp;nbsp;clause should be part of the &lt;EM&gt;&lt;STRONG&gt;select&lt;/STRONG&gt;&lt;/EM&gt;&amp;nbsp;statement, but you separated the &lt;EM&gt;&lt;STRONG&gt;group by&lt;/STRONG&gt;&lt;/EM&gt; from the &lt;EM&gt;&lt;STRONG&gt;select&lt;/STRONG&gt;&lt;/EM&gt; with a semi-colon.&amp;nbsp; Remove it.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Mar 2022 14:17:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-with-SAS-PROC-SQL-errors/m-p/803575#M316416</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2022-03-23T14:17:02Z</dc:date>
    </item>
    <item>
      <title>Re: Help with SAS PROC SQL errors</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-with-SAS-PROC-SQL-errors/m-p/803576#M316417</link>
      <description>&lt;P&gt;Please show us the ENTIRE log for each PROC SQL, as text (not screen capture) by copying the log and pasting it into the window that appears when you click on the &amp;lt;/&amp;gt; icon. DO NOT SHOW US PORTIONS OF THE LOG!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2021-11-26 08_27_29-Reply to Message - SAS Support Communities — Mozilla Firefox.png" style="width: 859px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/66123iA4EF494F9CA0F6EE/image-size/large?v=v2&amp;amp;px=999" role="button" title="2021-11-26 08_27_29-Reply to Message - SAS Support Communities — Mozilla Firefox.png" alt="2021-11-26 08_27_29-Reply to Message - SAS Support Communities — Mozilla Firefox.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Mar 2022 14:19:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-with-SAS-PROC-SQL-errors/m-p/803576#M316417</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-03-23T14:19:11Z</dc:date>
    </item>
    <item>
      <title>Re: SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-with-SAS-PROC-SQL-errors/m-p/803577#M316418</link>
      <description>&lt;P&gt;SAS has two data types, numeric and character. When you get any comment about "different types" it means one of the values you used is character and the other is numeric. So the errors come because you compare a character value to numeric.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The bit about different data sets do not behave the same means that the variable for some reason is numeric in one set and character in another. The single most likely cause of this that you are bringing data into SAS using Proc Import or a wizard/tool that uses Proc Import and there is something in the source file that makes SAS think one of the source columns should be treated as character.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Common causes values that contain text like "NA" "NULL" or "MISSING" or some character attached to a number such as "&amp;lt;10" or possibly a range indicated like "10-13".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are reading multiple source files that should have the same structure and variable then Data step code is the preferred method to guarantee that each of the created SAS data sets has the same behavior.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The bit about import may be more critical if your files start as spread sheets as those do not impose many rules on what ends up in any given column. Also, if you have some text files, such as CSV, that are opened by spreadsheet software and then saved you may have had the contents of columns actually changed.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Mar 2022 14:19:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-with-SAS-PROC-SQL-errors/m-p/803577#M316418</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-03-23T14:19:26Z</dc:date>
    </item>
  </channel>
</rss>

