BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Aexor
Lapis Lazuli | Level 10

I am getting error while inserting data using proc fedsql

 

Proc fedsql;

 create table paylist

 (IdNum char(4),

 Gender char(1),

 Jobcode char(3),

 Salary double,

 Birth date,

 Hired date);

insert into paylist

 values('1639','F','TA1',42260,date'26JUN70',date'28JAN91')

 values('1065','M','ME3',38090,date'26JAN54',date'07JAN92')

 values('1400','M','ME1',29769,date'05NOV67',date'16OCT90')

 values('1561','M',null,36514,date'30NOV63',date'07OCT87')

 values('1221','F','FA3',.,date'22SEP63',date'04OCT94');

quit;

 

error : syntax error at or near values.

Please help me to resolve this issue.

1 ACCEPTED SOLUTION

Accepted Solutions
Patrick
Opal | Level 21

According to the documentation here you have to repeat the insert into statement. Additionally the date string format must be as in below code.

proc datasets lib=work nolist nowarn;
  delete paylist;
  run;
quit;

Proc fedsql;
  create table paylist
    (IdNum char(4),
    Gender char(1),
    Jobcode char(3),
    Salary double,
    Birth date,
    Hired date)
    ;
  insert into paylist values ('1639','F','TA1',42260,date'1970-06-26',date'1991-01-28');
  insert into paylist values ('1639','F','TA1',42260,date'1970-06-26',date'1991-01-28');
quit;

 

View solution in original post

3 REPLIES 3
ChrisNZ
Tourmaline | Level 20

Like this?

INSERT INTO MyTable ( Column1, Column2 ) VALUES ( Value1, Value2 ), ( Value1, Value2 )
Patrick
Opal | Level 21

According to the documentation here you have to repeat the insert into statement. Additionally the date string format must be as in below code.

proc datasets lib=work nolist nowarn;
  delete paylist;
  run;
quit;

Proc fedsql;
  create table paylist
    (IdNum char(4),
    Gender char(1),
    Jobcode char(3),
    Salary double,
    Birth date,
    Hired date)
    ;
  insert into paylist values ('1639','F','TA1',42260,date'1970-06-26',date'1991-01-28');
  insert into paylist values ('1639','F','TA1',42260,date'1970-06-26',date'1991-01-28');
quit;

 

ChrisNZ
Tourmaline | Level 20

Oh that's (slightly) disappointing. The comma separated syntax would be useful (and potentially faster).

I should have tested, but then I never use proc fedsql, and I simply assumed this standard syntax would be supported. My bad.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 706 views
  • 4 likes
  • 3 in conversation