I'm trying to view the contents of a dataset in the SASHelp library, but it gives me these errors. I'm not sure what is wrong with my simple code:
Code:
proc sql;
Select top 2 * from sashelp.aacomp;
quit;
Errors:
ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, (, *, **, +, ',', -, /, <, <=, <>, =, >, >=, ?, AND, BETWEEN,
CONTAINS, EQ, EQT, GE, GET, GT, GTT, LE, LET, LIKE, LT, LTT, NE, NET, OR, ^=, |, ||, ~=.
ERROR 76-322: Syntax error, statement will be ignored.
@astha8882000 wrote:
I'm trying to view the contents of a dataset in the SASHelp library, but it gives me these errors. I'm not sure what is wrong with my simple code:
Code:
proc sql;
Select top 2 * from sashelp.aacomp;
quit;
Errors:
ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, (, *, **, +, ',', -, /, <, <=, <>, =, >, >=, ?, AND, BETWEEN,
CONTAINS, EQ, EQT, GE, GET, GT, GTT, LE, LET, LIKE, LT, LTT, NE, NET, OR, ^=, |, ||, ~=.ERROR 76-322: Syntax error, statement will be ignored.
Your select has two items, a variable called top and the literal 2. These items need to be separated by a comma to get valid SQL syntax.
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!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.