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.
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;
Like this?
INSERT INTO MyTable ( Column1, Column2 ) VALUES ( Value1, Value2 ), ( Value1, Value2 )
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;
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.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.
Ready to level-up your skills? Choose your own adventure.