BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Rsadiq1
Calcite | Level 5

          options nocenter compress=yes nomlogic symbolgen;
2          options nofullstimer mprint;
3         
4          libname ayb "hasasaa/reporting/projects/adhoc_pm_sadiq/sasdata";
NOTE: Library AYB does not exist.
5          libname ayb_lu "hasasaa/reporting/projects/p_6018_AYB/sasdata";
NOTE: Library AYB_LU does not exist.
6         
7         
8          Proc sql;
9           Create table match_ayb as
10          Select a.*
11          ,b.*
12          From ayb_lu.lu_ayb as a
13          left join ayb.AYB-WELLNESS CNPS_Q1 2017 as b
                             _
                             22
                             76
ERROR 22-322: Syntax error, expecting one of the following: a name, (, AS, ON. 

 

Hello I keep getting this error, also it is saying my libaraires do not exist. If someone could help, that would be helpful!

 

Thank you

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User
hasasaa/reporting/projects/p_6018_AYB/sasdata

is a UNIX relative path name (does not start with a forward slash, and therefore not at the root directory), so SAS will start searching from the directory where the SAS process was started (usually a location in the SAS configuration tree), so you won't find the directory for the library.

Use the absolute path, starting at the root directory of the server; if the path is found in your home directory ("Files" in Enterprise Guide), use $HOME as the start.

View solution in original post

6 REPLIES 6
PeterClemmensen
Tourmaline | Level 20

Seems to me that you have a space in

 

ayb.AYB-WELLNESS CNPS_Q1 2017 as b

which causes this problem

 

Rsadiq1
Calcite | Level 5

I did take out the space but the same error keeps coming up

Rsadiq1
Calcite | Level 5

Hello

 

I keep getting this error while trying to join, and also my libaries are saying do not exist? I just wanted to see where the on, as was missing. I cant seem to figure it out thanks

 

 

 

NOTE: Library SASDATA does not exist.
5          libname sasdatap "hasasaa/reporting/projects/p_6018_AYB/sasdata";
NOTE: Library SASDATAP does not exist.
6         
7         
8          Proc sql;
9           Create table match_ayb as
10          Select a.*
11          ,b.*
12          From sasdatap.lu_ayb a
13          Left join sasdata.AYB-WELLNESSCNPS_Q12017 b
                                 _
                                 22
                                 76
ERROR 22-322: Syntax error, expecting one of the following: a name, (, AS, ON. 

Kurt_Bremser
Super User
AYB-WELLNESSCNPS_Q12017

is not a valid SAS name (only characters, digits and underlines). Replace the dash with an underline (as it should already have been, as you wouldn't be able to create such a dataset anyway).

Kurt_Bremser
Super User
hasasaa/reporting/projects/p_6018_AYB/sasdata

is a UNIX relative path name (does not start with a forward slash, and therefore not at the root directory), so SAS will start searching from the directory where the SAS process was started (usually a location in the SAS configuration tree), so you won't find the directory for the library.

Use the absolute path, starting at the root directory of the server; if the path is found in your home directory ("Files" in Enterprise Guide), use $HOME as the start.

ballardw
Super User

It also helps to post error messages with code from the log into a code box opened with the forum {i} icon as the main message windows reformat your text somewhat and the position of the _ in the error message helps diagnose the code.

Example with code box:

55   proc sql;
56      select *
57      from sashelp.c-lass;
                      -
                      22
                      76
ERROR 22-322: Syntax error, expecting one of the following: GROUP, HAVING, ORDER, WHERE.

the _ is under the dash showing where the exact error is.

 

But in the main window:

55 proc sql;

56 select *

57 from sashelp.c-lass;

-

22

76

ERROR 22-322: Syntax error, expecting one of the following: GROUP, HAVING, ORDER, WHERE.

 

The _ indicator is now in a much less helpful position.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 1184 views
  • 0 likes
  • 4 in conversation