BookmarkSubscribeRSS Feed
marcio_marques
Calcite | Level 5

Pessoal, boa noite!

 

Eu conecto o SAS com o teradata para realizar algumas pesquisas, no entanto o código criado está um tanto quanto operacional. Será que existe uma forma executar a minha rotina de uma forma mais inteligente?

Código utilizado:

 

código no sas para conectar com as tabelas do Teradata (usuário e senha)

create table NOME as;

select *

from tabela 1;

where campo1 in ('10','20','30','40,'50');

quit; 

 

Ás vezes, a quantidade de dados para incluir dentro dos parênteses é muito grande o que ocorre em erro for limitação do sistema. Neste caso, divido os dados em várias partes para conseguir incluir no código e executar o código.

 

Como a tabela 1 está em uma base do sas e os dados do campo1 estão em uma tabela do teradata, pensei em criar uma tabela 2, com todos os dados (10,20,30,40,50,60....) e incluir no código essa tabela, é possível?

 

Exemplo

tabela 2/campo2 = 10,20,30,40,50,60

 

 

create table NOME as;

select *

from tabela 1;

where campo1 in (select campo2 from tabela 2);

quit; 

 

 

 

 

 

 

 

2 REPLIES 2
ChrisNZ
Tourmaline | Level 20

You can only do that if you are allowed to upload data to a temp Teradata table.

Are you?

 

Otherwise, what's the limit you are reaching?

Number of items in the in() clause? If so, split it into several in() clauses separated with OR  

Overall length of the Teradata query? In that case there's nothing you can do. I think the limit is 1 MB though, which is rather large.

 

marcio_marques
Calcite | Level 5
CrisNZ, bom dia!
Obrigado pelas informações!

Não tenho permissão para carregar dados no teradata.

A base que tenho tem cerca de 132 mil registros.

Atualmente, eu executo o código por etapa, com 20 mil registro por etapa.

Eu não entendi a sua sugestão de usar "cláusula in() OR , poderi explicar mais detalhadamente, por favor.

Obrigado mais uma vez.

Marcio




SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 564 views
  • 0 likes
  • 2 in conversation