SAS Enterprise Guide

Desktop productivity for business analysts and programmers
BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
IgawaKei29
Quartz | Level 8

I have been looking at this code syntax for hours, the Teradata code runs in a different environment, but bringing it through Enterprise Guide is giving me issues.  The error I am getting is: ERROR: Teradata execute: Syntax error: expected something between ')' and ';'.  I can't seem to figure out what the issue is.  I appreciate any help or insight on this.

 

PROC SQL NOERRORSTOP;
CONNECT TO TERADATA (AUTHDOMAIN=xx  server="xxx" connection=global mode=teradata);
  execute (drop table TestServer.Test3) BY Teradata;
  execute (create table TestServer.Test3 as
  
(
select *
from TestServer.Test1

UNION ALL

select * 
from TestServer.Test2

))BY Teradata;
 quit;
1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

In Teradata syntax there are two key things you have left out.

 

1) At the end of the CREATE TABLE statement you need some like WITH DATA (look up the syntax I don't remember it exactly) if you actually want the data to be saved.

2) Teradata is a highly parallel setup.  It does this by partitioning the data with a PRIMARY INDEX.  You want a primary index that does not skew the data so that only some of the "nodes" have all of the data.  If you do not specify the PRIMARY INDEX then it will pick the first variable.  Which might be a very poor choice.  

View solution in original post

4 REPLIES 4
SASKiwi
PROC Star

Try it without the extra brackets:

PROC SQL NOERRORSTOP;
CONNECT TO TERADATA (AUTHDOMAIN=xx  server="xxx" connection=global mode=teradata);
  execute (drop table TestServer.Test3) BY Teradata;
  execute (create table TestServer.Test3 as
select *
from TestServer.Test1
UNION ALL
select * 
from TestServer.Test2
) BY Teradata;
 quit;
IgawaKei29
Quartz | Level 8
I tried without the extra brackets and got the message:
ERROR: Teradata execute: Syntax error, expected something like a name or a Unicode delimited identifier or '(' between the 'as'
keyword and the 'select' keyword.
Tom
Super User Tom
Super User

In Teradata syntax there are two key things you have left out.

 

1) At the end of the CREATE TABLE statement you need some like WITH DATA (look up the syntax I don't remember it exactly) if you actually want the data to be saved.

2) Teradata is a highly parallel setup.  It does this by partitioning the data with a PRIMARY INDEX.  You want a primary index that does not skew the data so that only some of the "nodes" have all of the data.  If you do not specify the PRIMARY INDEX then it will pick the first variable.  Which might be a very poor choice.  

IgawaKei29
Quartz | Level 8
Thank you! That was it.. I was missing the With Data and Primary Index! Really appreciate the help.

) with data primary index(id)) by teradata;

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
  • 4 replies
  • 1192 views
  • 2 likes
  • 3 in conversation