SAS Enterprise Guide

Desktop productivity for business analysts and programmers
BookmarkSubscribeRSS Feed
ABBUD765
Calcite | Level 5

Pessoal, eu estou rodando uma query no SAS e está dando um erro. 
Já rodei outras códigos com os mesmos Where e funcionou, pode ser que eu esteja fazendo algum JOIN errado, ainda sou novo e estou tentando descobrir qual é a chave de cada tabela. 

O Código: 

PROC SQL;
CREATE TABLE WORK.QUERY_FOR_TB_DIM_UNDE_SCD AS
SELECT
t1.DS_ORIGEM,
t1.DS_CANAL,
t1.DS_UNIDADE_MKT,
t1.DS_REGIONAL,
t1.DS_GERENTE_SENIOR,
t1.DS_DIRETOR,
t1.DS_SUPERVISOR,
t1.DS_GRUPO_ECONOMICO,
t2.DS_CURSO_MKT,
t3.FL_BOLETO_PAGO,
t3.FL_BOLETO_DISPONIVEL,
t3.DT_PAGAMENTO,
t4.CD_CANDIDATO,
t4.CD_MATRICULA,
t4.CD_CURSO_1_OPC,
t4.DS_MODALIDADE,
t4.CD_POLO,
t4.DT_INSCRICAO,
t5.DS_SITUACAO_ACADEMICA,
t5.FL_PMA,
t5.FL_REMATRICULADO,
t5.DT_REMATRICULA
FROM ESDISTGS.TB_DIM_UNDE_SCD t1
INNER JOIN ESDISTGS.TB_DIM_CURSO t2 ON t1.DS_ORIGEM = t2.DS_SISTEMA_ORIGEM /*Ok*/
INNER JOIN ESDISTGS.TGT_BI_BOLETOS t3 ON t5.NR_CPF = t3.NR_CPF /*Ok*/
INNER JOIN ESDISTGS.TGT_BI_CAPTACAO_UNPR_GRAD t4 ON t1.CD_UNIDADE = t4.CD_POLO /*Ok*/
INNER JOIN ESDISTGS.TGT_BI_RETENCAO_ANALITICO t5 ON t1.DS_CANAL = t5.DS_CANAL
WHERE t5.DT_BASE = TODAY() - 1
AND t4.CD_MATRICULA = '45';
QUIT;

E esse é o erro que está dando:

ERROR: Expression using equals (=) has components that are of different data types.

1 REPLY 1
PaigeMiller
Diamond | Level 26
INNER JOIN ESDISTGS.TB_DIM_CURSO t2 ON t1.DS_ORIGEM = t2.DS_SISTEMA_ORIGEM

 

If t1.DS_ORIGEM is numeric and t2.DS_SISTEMA_ORIGEM is character, or the other way around, this will cause the SQL to fail and produce the error message shown. It doesn't have to be this condition, you have 4 INNER JOINS and 2 WHERE conditions that could cause this error, there is no way for me to determine which of these is the problem. You can check to find which of these variables are numeric and which are character, and then you can fix the problem.

--
Paige Miller

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!

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

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
  • 1 reply
  • 595 views
  • 0 likes
  • 2 in conversation