SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
AllanBowe
Barite | Level 11

It appears to be a bug on the TABLE_CATALOG field in dictionary.TABLE_CONSTRAINTS 

 

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";

The behaviour is exhibited with other functions as well.  The behaviour does not apply to other columns (eg TABLE_NAME).

 

SYSVLONG=9.04.01M7P080520

/Allan
SAS Challenges - SASensei
MacroCore library for app developers
SAS networking events (BeLux, Germany, UK&I)

Data Workflows, Data Contracts, Data Lineage, Drag & drop excel EUCs to SAS 9 & Viya - Data Controller
DevOps and AppDev on SAS 9 / Viya / Base SAS - SASjs
1 ACCEPTED SOLUTION

Accepted Solutions
Oligolas
Barite | Level 11

Indeed.

These methods would work

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';

But not these ones either:


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'; 

 

________________________

- Cheers -

View solution in original post

2 REPLIES 2
Oligolas
Barite | Level 11

Indeed.

These methods would work

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';

But not these ones either:


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'; 

 

________________________

- Cheers -

AllanBowe
Barite | Level 11

Thanks @Oligolas - indeed, that was the approach I used to fix my issue:  https://github.com/sasjs/core/pull/84/files#diff-60df2277f57ab4c7bbd043138958de8dc28e6ccddfddb9e8501...

 

Interesting to see that the problem applies to sashelp.vtabcon also.  And nice idea with the subquery.

 

Also credit to @yabwon who investigated behind the scenes, which resulted in a vastly refined / simpler question.

/Allan
SAS Challenges - SASensei
MacroCore library for app developers
SAS networking events (BeLux, Germany, UK&I)

Data Workflows, Data Contracts, Data Lineage, Drag & drop excel EUCs to SAS 9 & Viya - Data Controller
DevOps and AppDev on SAS 9 / Viya / Base SAS - SASjs

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1074 views
  • 4 likes
  • 2 in conversation