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!.
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;
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;
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.
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 ...........
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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: