how can i fix the syntax error?
proc sql;
create table cars11 as
select make,
type,
Mean (horsepower) as Mean1,
Mean (invoice) as Mean2,
Mean (weight) as Mean3,
From sashelp.cars,
Group by make, type;
quit;
No comma after the last variable name and before FROM
Also no comma after FROM SASHELP.CARS
proc sql;
create table cars11 as
select make,
type,
Mean (horsepower) as Horsepower_Mean,
Mean (invoice) as Invoice_Mean,
Mean (weight) as Weight_Mean
from sashelp.cars
group by make, type;
quit;
Pro tip: putting the commas before the variable in PROC SQL and indenting the code helps eliminate the first error, which is a common error
proc sql;
create table cars11 as select
make
,type
,Mean (horsepower) as Horsepower_Mean
,Mean (invoice) as Invoice_Mean
,Mean (weight) as Weight_Mean
from sashelp.cars
group by make, type;
quit;
No comma after the last variable name and before FROM
Also no comma after FROM SASHELP.CARS
proc sql;
create table cars11 as
select make,
type,
Mean (horsepower) as Horsepower_Mean,
Mean (invoice) as Invoice_Mean,
Mean (weight) as Weight_Mean
from sashelp.cars
group by make, type;
quit;
Pro tip: putting the commas before the variable in PROC SQL and indenting the code helps eliminate the first error, which is a common error
proc sql;
create table cars11 as select
make
,type
,Mean (horsepower) as Horsepower_Mean
,Mean (invoice) as Invoice_Mean
,Mean (weight) as Weight_Mean
from sashelp.cars
group by make, type;
quit;
i have an error again;
Syntax error, expecting one of the following: ',', GROUP, ORDER.
Please post the complete (all code and messages) log of the step by copy/pasting it into a window opened with this button:
remove the semicolons after Mean3 and sashelp.cars
- Cheers -
Thank you
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 save with the early bird rate—just $795!
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.