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

Hi, 

I'm new at SAS so I hope my description is accurrate. I'm using SAS Enterprise Guide 9.4. 

I'm working with databases available in a remote server, and I am trying to calculate an average on two variables. 

Here is my code: 

 

proc sql; 

create table "AVG1" as 

SELECT *, AVG(RMEANIMT+LMEANIMT) AS AVG1

FROM WORK.QUERY_FOR_APPEND_TABLE; 

QUIT; 

 

 

Here is the log: 

proc sql

CREATE TABLE "AVG 1" AS 

SELECT *, AVG(RMEANIMT+LMEANIMT) AS AVG1

FROM WORK.QUERY_FOR_APPEND_TABLE; 

 

NOTE: The query requieres remerging summary statistics back with the original data

ERROR: User does not have appropriate authorization level for library WC000001. 

 

However I don't have any library with that name. My guess is that it comes from the WORK library but I'm not sure how to reference it. 

Thank you!.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

You probably need to talk to your IT area or SAS administrator. Your code doesn't have any errors so that's fine, its some other issue.

 

You can verify if the code below will also give you an error:

proc sql; 
create table average1 as 
SELECT *, AVG(RMEANIMT+LMEANIMT) AS AVG1
FROM WORK.QUERY_FOR_APPEND_TABLE; 
QUIT; 
 

View solution in original post

5 REPLIES 5
Reeza
Super User

You probably need to talk to your IT area or SAS administrator. Your code doesn't have any errors so that's fine, its some other issue.

 

You can verify if the code below will also give you an error:

proc sql; 
create table average1 as 
SELECT *, AVG(RMEANIMT+LMEANIMT) AS AVG1
FROM WORK.QUERY_FOR_APPEND_TABLE; 
QUIT; 
 
MerAgSo
Calcite | Level 5
Apparently that was the whole problem, I changed the code and it ran
perfectly. Thank you very much.
ChrisHemedinger
Community Manager

Update: Now I see, as @Astounding pointed out, the quoted table name was the cause.  This told SAS to consider the table as a file name, not a member of a SAS library, and that's where the WCnnnnn libref came from.  

The "WC000001" tells me that a preceding step used a SAS data set directly from the file system, rather than via a library that you explicitly defined.   This technique causes SAS to assign a temporary libname behind the scenes, and the name looks like "WCnnnnnn". Instead of opening/adding a sas7bdat file directly in EG, you should first use a LIBNAME statement to define a library that maps to the folder.  That step can be in code or using the Assign Library wizard in EG.

 

Then, when you run the next step in the flow, the library definition will already be in place.

Check out SAS Innovate on-demand content! Watch the main stage sessions, keynotes, and over 20 technical breakout sessions!
Astounding
PROC Star

Why the weird data set name?  Get rid of the quotes, get rid of the space between AVG and 1, and just:

 

create table AVG1 as ...........

Reeza
Super User

If you really want table names like that you can add an N to the end, this is known as a name literal.

 

proc sql; 
create table "AVG1"n as 
SELECT *, AVG(weight) AS AVG1
FROM sashelp.class; 
QUIT; 

I don't recommend doing that though, because then you have to type more (3 extra characters) per data set name and it makes it harder to use short cut references to data sets.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 5 replies
  • 11033 views
  • 1 like
  • 4 in conversation