<?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: Unexpected Where Clause behaviour in dictionary.TABLE_CONSTRAINTS (TABLE_CATALOG) in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Unexpected-Where-Clause-behaviour-in-dictionary-TABLE/m-p/771579#M244885</link>
    <description>&lt;P&gt;Indeed.&lt;/P&gt;
&lt;P&gt;These methods would work&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;create table work.has_records1 as 
  select * ,upcase(TABLE_CATALOG) as test from sashelp.vtabcon
  where calculated test eq upper("WoRK");

create table work.has_records2 as 
  select *  from (select *,TABLE_CATALOG as TABLE_CATALOG1 from sashelp.vtabcon)
  where upcase(TABLE_CATALOG1) eq 'WORK';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But not these ones either:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
create table work.zero_records1 as 
  select *  from sashelp.vtabcon
  where upper(TABLE_CATALOG) eq 'WORK';

/* this table has no records */
create table work.zero_records2 as 
  select * from dictionary.TABLE_CONSTRAINTS 
  where prxmatch('/work/oi',strip(TABLE_CATALOG));

create table work.zero_records3 as 
  select *  from sashelp.vtabcon
  where strip(lower(TABLE_CATALOG)) eq 'work';&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 01 Oct 2021 13:18:55 GMT</pubDate>
    <dc:creator>Oligolas</dc:creator>
    <dc:date>2021-10-01T13:18:55Z</dc:date>
    <item>
      <title>Unexpected Where Clause behaviour in dictionary.TABLE_CONSTRAINTS (TABLE_CATALOG)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unexpected-Where-Clause-behaviour-in-dictionary-TABLE/m-p/771554#M244867</link>
      <description>&lt;P&gt;It appears to be a bug on the TABLE_CATALOG field in&amp;nbsp;dictionary.TABLE_CONSTRAINTS&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table work.example(
  TX_FROM float format=datetime19.,
  DD_TYPE char(16),
  DD_SOURCE char(2048),
  DD_SHORTDESC char(256),
  constraint pk primary key(tx_from, dd_type,dd_source),
  constraint unq unique(tx_from, dd_type),
  constraint nnn not null(DD_SHORTDESC)
);

/* this table has no records */
create table work.zero_records as 
  select * from dictionary.TABLE_CONSTRAINTS 
  where upcase(TABLE_CATALOG)="WORK";

/* this table has expected records */
create table work.has_records as 
  select * from dictionary.TABLE_CONSTRAINTS 
  where TABLE_CATALOG="WORK";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The behaviour is exhibited with other functions as well.&amp;nbsp; The behaviour does not apply to other columns (eg TABLE_NAME).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;S&lt;SPAN style="font-family: inherit;"&gt;YSVLONG=9.04.01M7P080520&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Oct 2021 11:00:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unexpected-Where-Clause-behaviour-in-dictionary-TABLE/m-p/771554#M244867</guid>
      <dc:creator>AllanBowe</dc:creator>
      <dc:date>2021-10-01T11:00:03Z</dc:date>
    </item>
    <item>
      <title>Re: Unexpected Where Clause behaviour in dictionary.TABLE_CONSTRAINTS (TABLE_CATALOG)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unexpected-Where-Clause-behaviour-in-dictionary-TABLE/m-p/771579#M244885</link>
      <description>&lt;P&gt;Indeed.&lt;/P&gt;
&lt;P&gt;These methods would work&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;create table work.has_records1 as 
  select * ,upcase(TABLE_CATALOG) as test from sashelp.vtabcon
  where calculated test eq upper("WoRK");

create table work.has_records2 as 
  select *  from (select *,TABLE_CATALOG as TABLE_CATALOG1 from sashelp.vtabcon)
  where upcase(TABLE_CATALOG1) eq 'WORK';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But not these ones either:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
create table work.zero_records1 as 
  select *  from sashelp.vtabcon
  where upper(TABLE_CATALOG) eq 'WORK';

/* this table has no records */
create table work.zero_records2 as 
  select * from dictionary.TABLE_CONSTRAINTS 
  where prxmatch('/work/oi',strip(TABLE_CATALOG));

create table work.zero_records3 as 
  select *  from sashelp.vtabcon
  where strip(lower(TABLE_CATALOG)) eq 'work';&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Oct 2021 13:18:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unexpected-Where-Clause-behaviour-in-dictionary-TABLE/m-p/771579#M244885</guid>
      <dc:creator>Oligolas</dc:creator>
      <dc:date>2021-10-01T13:18:55Z</dc:date>
    </item>
    <item>
      <title>Re: Unexpected Where Clause behaviour in dictionary.TABLE_CONSTRAINTS (TABLE_CATALOG)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unexpected-Where-Clause-behaviour-in-dictionary-TABLE/m-p/771585#M244889</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/77163"&gt;@Oligolas&lt;/a&gt;&amp;nbsp;- indeed, that was the approach I used to fix my issue:&amp;nbsp;&amp;nbsp;&lt;A href="https://github.com/sasjs/core/pull/84/files#diff-60df2277f57ab4c7bbd043138958de8dc28e6ccddfddb9e8501bd52facf6e585R56" target="_blank"&gt;https://github.com/sasjs/core/pull/84/files#diff-60df2277f57ab4c7bbd043138958de8dc28e6ccddfddb9e8501bd52facf6e585R56&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Interesting to see that the problem applies to&amp;nbsp;sashelp.vtabcon also.&amp;nbsp; And nice idea with the subquery.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also credit to&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/35763"&gt;@yabwon&lt;/a&gt;&amp;nbsp;who investigated behind the scenes, which resulted in a vastly refined / simpler question.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Oct 2021 13:24:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unexpected-Where-Clause-behaviour-in-dictionary-TABLE/m-p/771585#M244889</guid>
      <dc:creator>AllanBowe</dc:creator>
      <dc:date>2021-10-01T13:24:33Z</dc:date>
    </item>
  </channel>
</rss>

