How to use select statement in a value statement

2019-09-10 09:54发布

I'm not sure what's wrong with my code. The log is saying that the select has a syntax error which I copied below. How do I fix this?

"Syntax error, expecting one of the following: a quoted string, a numeric constant,a datetime constant, a missing value, +, -, MISSING, NULL, USER.

ERROR: Syntax error, statement will be ignored."

proc sql;
    insert into orion.test  (Fruits, Vegetables, Drinks, Meats)
        values (select a.fruit, a.veggie, a.drink, a.meat FROM work.meals AS a);
quit;

标签: sas proc-sql
1条回答
劫难
2楼-- · 2019-09-10 10:12

This should be:

proc sql;
    insert into orion.test  (Fruits, Vegetables, Drinks, Meats)
        select a.fruit, a.veggie, a.drink, a.meat FROM work.meals AS a;
quit;

In your original VALUES clause you can only use constants.

查看更多
登录 后发表回答