Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does SAS allow ORDER BY in a CREATE statement?

Tags:

sas

I tried to ORDER a table while creating it, but then noticed that SAS does not allow it . Here is the code

proc sql;
create table test as (
select * 
from sashelp.class
order by name);
quit;

Here are the errors that I get :

1383  order by name);
      -----
      79
ERROR 79-322: Expecting a ).

1383! order by name);
                   -
                   79
ERROR 79-322: Expecting a (.

I can certainly use proc sort but I read the CREATE TABLE documentation and did not find any restrictions placed on ORDER BY other than it is not recommended . SAS documentation lists the create . . order by as a valid syntax . So what is the problem here ?

By The Way . . simple select . . order by works fine

proc sql;
select * 
from sashelp.class
order by name;
quit;*
like image 430
Buras Avatar asked May 20 '26 20:05

Buras


1 Answers

Remove the parentheses:

proc sql;
create table test as
select * 
from sashelp.class
order by name;
quit;

Not sure why SAS doesn't like them - I think it's because they are for subqueries only, which technically this isn't. At any rate you do not need them.

like image 50
sparc_spread Avatar answered May 22 '26 15:05

sparc_spread



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!