<?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: Problems with ODBC connection (var names) in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Problems-with-ODBC-connection-var-names/m-p/927519#M364995</link>
    <description>&lt;P&gt;A hint on how to read SAS error messages.&lt;/P&gt;
&lt;P&gt;When you get a section of code underlined, as in this example, SAS is telling you where it found a problem. Sometimes the actual problem may be a missing semicolon on a previous line making the current line incorrect but that usually shows the underline at the start of the offending line(s).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So this message relates to the entire key_figures.pyear.&amp;nbsp; A very little research of code referencing variables will show that generally there is no two level name used in the data step. When it does occur it relates to specific types of uses such as First. Last. (used with BY group variables), hash keys and iterators and a few other elements of the Component Objects related to logging and Java.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/465795"&gt;@rubence&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have the following ODBC connection:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=""&gt;LIBNAME IFRS17_H ODBC DATAsrc=IFRS17_HIVE SCHEMA=ifrs17catalog USER="rubence" PASSWORD="XXXXXXXXXXX";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I try to use a WHERE clause,&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=""&gt;data KFS;
set IFRS17_H.key_figures;
where key_figures.pyear='2024';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;SAS shows the following message:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="rubence_0-1715157292434.png" style="width: 659px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/96311i2B658391829D4491/image-dimensions/659x150?v=v2" width="659" height="150" role="button" title="rubence_0-1715157292434.png" alt="rubence_0-1715157292434.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 if I do not use a WHERE clause, I have no problems and the var names in the new table follows the structure: TABLE_NAME.VAR_NAME.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My questions are:&lt;/P&gt;
&lt;P&gt;a) How can I avoid to download the full table?&lt;/P&gt;
&lt;P&gt;b) Is It possible to use only the VAR_NAME and not TABLE_NAME.VAR_NAME?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Many thanks for your great help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 08 May 2024 13:53:24 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2024-05-08T13:53:24Z</dc:date>
    <item>
      <title>Problems with ODBC connection (var names)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problems-with-ODBC-connection-var-names/m-p/927488#M364987</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following ODBC connection:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;LIBNAME IFRS17_H ODBC DATAsrc=IFRS17_HIVE SCHEMA=ifrs17catalog USER="rubence" PASSWORD="XXXXXXXXXXX";&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I try to use a WHERE clause,&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data KFS;
set IFRS17_H.key_figures;
where key_figures.pyear='2024';
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;SAS shows the following message:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="rubence_0-1715157292434.png" style="width: 659px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/96311i2B658391829D4491/image-dimensions/659x150?v=v2" width="659" height="150" role="button" title="rubence_0-1715157292434.png" alt="rubence_0-1715157292434.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 if I do not use a WHERE clause, I have no problems and the var names in the new table follows the structure: TABLE_NAME.VAR_NAME.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My questions are:&lt;/P&gt;&lt;P&gt;a) How can I avoid to download the full table?&lt;/P&gt;&lt;P&gt;b) Is It possible to use only the VAR_NAME and not TABLE_NAME.VAR_NAME?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks for your great help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2024 09:34:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problems-with-ODBC-connection-var-names/m-p/927488#M364987</guid>
      <dc:creator>rubence</dc:creator>
      <dc:date>2024-05-08T09:34:49Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with ODBC connection (var names)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problems-with-ODBC-connection-var-names/m-p/927492#M364989</link>
      <description>&lt;P&gt;SAS data step syntax doesn't require (and doesn't support) two level names for variables.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data KFS;
set IFRS17_H.key_figures;
where pyear='2024';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In your syntax you expect variable pyear to be of type character. Should this not be the case (=it's numeric) then get rid of the quotes. ...and should this still not return the expected result then try &lt;EM&gt;year(pyear)=2024&lt;/EM&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2024 09:54:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problems-with-ODBC-connection-var-names/m-p/927492#M364989</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2024-05-08T09:54:55Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with ODBC connection (var names)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problems-with-ODBC-connection-var-names/m-p/927519#M364995</link>
      <description>&lt;P&gt;A hint on how to read SAS error messages.&lt;/P&gt;
&lt;P&gt;When you get a section of code underlined, as in this example, SAS is telling you where it found a problem. Sometimes the actual problem may be a missing semicolon on a previous line making the current line incorrect but that usually shows the underline at the start of the offending line(s).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So this message relates to the entire key_figures.pyear.&amp;nbsp; A very little research of code referencing variables will show that generally there is no two level name used in the data step. When it does occur it relates to specific types of uses such as First. Last. (used with BY group variables), hash keys and iterators and a few other elements of the Component Objects related to logging and Java.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/465795"&gt;@rubence&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have the following ODBC connection:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=""&gt;LIBNAME IFRS17_H ODBC DATAsrc=IFRS17_HIVE SCHEMA=ifrs17catalog USER="rubence" PASSWORD="XXXXXXXXXXX";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I try to use a WHERE clause,&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=""&gt;data KFS;
set IFRS17_H.key_figures;
where key_figures.pyear='2024';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;SAS shows the following message:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="rubence_0-1715157292434.png" style="width: 659px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/96311i2B658391829D4491/image-dimensions/659x150?v=v2" width="659" height="150" role="button" title="rubence_0-1715157292434.png" alt="rubence_0-1715157292434.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 if I do not use a WHERE clause, I have no problems and the var names in the new table follows the structure: TABLE_NAME.VAR_NAME.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My questions are:&lt;/P&gt;
&lt;P&gt;a) How can I avoid to download the full table?&lt;/P&gt;
&lt;P&gt;b) Is It possible to use only the VAR_NAME and not TABLE_NAME.VAR_NAME?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Many thanks for your great help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2024 13:53:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problems-with-ODBC-connection-var-names/m-p/927519#M364995</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-05-08T13:53:24Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with ODBC connection (var names)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problems-with-ODBC-connection-var-names/m-p/927522#M364996</link>
      <description>&lt;P&gt;If you have the VALIDVARNAME option set to ANY then you can reference a non-standard variable name by using a NAME LITERAL.&amp;nbsp; They work similar to DATE LITERALS.&amp;nbsp; You add quotes around the name and append the letter N.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where "key_figures.pyear"n='2024';&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 08 May 2024 13:55:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problems-with-ODBC-connection-var-names/m-p/927522#M364996</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-05-08T13:55:15Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with ODBC connection (var names)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problems-with-ODBC-connection-var-names/m-p/927648#M365038</link>
      <description>&lt;P&gt;I have tried your solution but SAS shows a new error:&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="rubence_0-1715245033895.png" style="width: 969px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/96367i801A8A6EBC0BF196/image-dimensions/969x407?v=v2" width="969" height="407" role="button" title="rubence_0-1715245033895.png" alt="rubence_0-1715245033895.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2024 08:58:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problems-with-ODBC-connection-var-names/m-p/927648#M365038</guid>
      <dc:creator>rubence</dc:creator>
      <dc:date>2024-05-09T08:58:15Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with ODBC connection (var names)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problems-with-ODBC-connection-var-names/m-p/927650#M365039</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/465795"&gt;@rubence&lt;/a&gt;&amp;nbsp;Use a ONE LEVEL NAME. This is SAS data step and not SQL syntax.&lt;/P&gt;
&lt;P&gt;data KFS;&lt;BR /&gt;&amp;nbsp; set IFRS17_H.key_figures;&lt;BR /&gt;&amp;nbsp; where &lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;&lt;STRIKE&gt;key_figures.&lt;/STRIKE&gt;&lt;/FONT&gt;&lt;/STRONG&gt;pyear='2024';&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;...or if you're more comfortable with SQL then use SQL.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
  create table work.KFS as
  select *
  from IFRS17_H.key_figures
  where key_figures.pyear='2024'
  ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;The 2nd error message you get show that the SAS data step code gets converted into the DB SQL flavour that then gets sent to the DB for processing (so the where clause could subset the data on the DB side before transferring the data to SAS). ...but because in your code the data step syntax is wrong things ain't working.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you add below options to your code then you'll get in the SAS log the info which SQL has been sent to the DB for in-database processing.&lt;/P&gt;
&lt;PRE&gt;options  sastrace=(,,,d) sastraceloc=saslog nostsuffix;&lt;/PRE&gt;</description>
      <pubDate>Thu, 09 May 2024 09:22:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problems-with-ODBC-connection-var-names/m-p/927650#M365039</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2024-05-09T09:22:57Z</dc:date>
    </item>
  </channel>
</rss>

