Help using Base SAS procedures

Not able to insert multiple values at a time by "insert into" in proc sql.

Reply
New Contributor
Posts: 2

Not able to insert multiple values at a time by "insert into" in proc sql.

Please do me a favour , I am trying to insert multiple rows in the table in db2 database via sas but i am not able to insert multiple rows at a time.

when i use

insert into table_name (a,b,c)

values('a',2,3);

it works but when i use

insert into table_name

select a,b,c

from table2.

then it is not working.

i am getting the error.

I am using SAS EG 6.0.


Super Contributor
Posts: 578

Re: Not able to insert multiple values at a time by "insert into" in proc sql.

I think your syntax might be wrong:

proc sql;

insert into table_name(a,b,c)

select a,b,c from table2;

quit;

New Contributor
Posts: 2

Re: Not able to insert multiple values at a time by "insert into" in proc sql.

Hi DBailey,

I used the same syntax as you wrote(correct one) but i am getting the error when i am trying to insert multiple rows at a time but not for a single row.

Contributor
Posts: 43

Re: Not able to insert multiple values at a time by "insert into" in proc sql.

try adding the clause values before select clause

Super Contributor
Posts: 282

Re: Not able to insert multiple values at a time by "insert into" in proc sql.

Hi,

If your table structures are the same, have you tried something like the following (untested):

insert into want

select * from have;

Regards,

Amir.

Trusted Advisor
Posts: 1,204

Re: Not able to insert multiple values at a time by "insert into" in proc sql.

It seems variables in table_name and table2 have different attributes. Try Proc contents to make sure both tables have same type of variables.

Ask a Question
Discussion stats
  • 5 replies
  • 253 views
  • 0 likes
  • 5 in conversation