BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
jorquec
Quartz | Level 8

Hi , 

 

Could you please help me to fix this code ? I didn't understand which is the issue.

I have a Teradata table IRM.Exploitrigger with 2 columns (ID,maxexploit_dt). 

I just would like to  add a new row with new  information on this table.

 

Many thanks in advance.

 

 

/* code*/							
proc sql;								
connect to teradata								
(user=&td_usr. password=&td_pass. server = 'edwprod' database = 'insights_consumer' mode = teradata);								
EXECUTE (								
CREATE MULTISET VOLATILE TABLE basedate AS								
(								
 select  
 1 as ID,
max(month_end_dt) as maxexploit_dt

from  profitability_sandbox.exploitation_layer_pm 

 ) WITH DATA PRIMARY INDEX(ID) ON COMMIT PRESERVE ROWS) BY TERADATA;  
Execute
(
proc sql;
 insert into 
 IRM.Exploitrigger (ID,maxexploit_dt)
( select ID,
maxexploit_dt  from  basedate) 
);
quit;


/* log*/

proc sql;
26       !          								
27         connect to teradata								
28         (user=&td_usr. password=&td_pass. server = 'edwprod' database = 'insights_consumer' mode = teradata);
28       !                                                                                                      								
29         EXECUTE (								
30         CREATE MULTISET VOLATILE TABLE basedate AS								
31         (								
32          select
33          1 as ID,
34         max(month_end_dt) as maxexploit_dt
35         
36         from  profitability_sandbox.exploitation_layer_pm
37         
38          ) WITH DATA PRIMARY INDEX(ID) ON COMMIT PRESERVE ROWS) BY TERADATA;
39         Execute
40         (
41         proc sql;
42          insert into
43          IRM.Exploitrigger (ID,maxexploit_dt)
44         ( select ID,
45         maxexploit_dt  from  basedate)
46         );
            _
            22
ERROR 22-322: Expecting a name.  
1 ACCEPTED SOLUTION

Accepted Solutions
ChrisNZ
Tourmaline | Level 20

 

1. Execute by xxx ()   contains native teradata SQL between the parentheses. 

proc sql; should be removed.

 

2. Execute must be used with BY.

 

3. A closing parenthesis is missing.

View solution in original post

1 REPLY 1
ChrisNZ
Tourmaline | Level 20

 

1. Execute by xxx ()   contains native teradata SQL between the parentheses. 

proc sql; should be removed.

 

2. Execute must be used with BY.

 

3. A closing parenthesis is missing.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

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