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

Hi All

 

I am a fairly new user to EG as I usually program in base SAS and then put scripts in a EG project to automate data runs.

I picked up this issue, and being unsure around EG, I am an not sure why its giving the error.

 

I have a macro that is called and creates table names using the following convention to create table names : "table_name". Code is given below. When I developed this in Base SAS, it gives no error. It writes these tables to a library called WC000001. When I put this in EG, it gave an error 'user access' (see screen shot below).

 

proc datasets library=work noprint;
 delete CDQ_CD_MOB;
run;

%macro run_CD_MOB(MOB);

	proc sql;
 		create table "CD_&MOB.MOB" as
			select *
			 from CDQ_monthly
			 where MOB = &MOB
			;
	quit;

 	proc append data="CD_&MOB.MOB" base= CDQ_CD_MOB;
	 run;

%mend run_CD_MOB;

%run_CD_MOB(3);
%run_CD_MOB(6);

user access issue.JPG

 

 

I'd appreciate input on two matters:

1. why does EG have this issue and how do I fix it.

2. how do I redirect this code to output the tables to a library of my own choosing (or to the work library). This will probably fix the issue anyway.

 

Thnx

 

GD

1 ACCEPTED SOLUTION

Accepted Solutions
ChrisHemedinger
Community Manager

I think SAS is interpreting the statement:

 

 create table "CD_&MOB.MOB"

 

As a reference to a filename, not a data set.  Try removing the quotes from the reference (in both the SQL and APPEND steps).

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.

View solution in original post

5 REPLIES 5
art297
Opal | Level 21

I'm confused! Where do you mention the library WC000001? And, should the various file names be in quotes?

 

Art, CEO, AnalystFinder.com

 

GenDemo
Quartz | Level 8

because I use a macro variable in the table name, you need to put quotation marks around the name. Because of this, SAS puts it into a temporary library (some some silly reason).

ChrisHemedinger
Community Manager

I think SAS is interpreting the statement:

 

 create table "CD_&MOB.MOB"

 

As a reference to a filename, not a data set.  Try removing the quotes from the reference (in both the SQL and APPEND steps).

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
GenDemo
Quartz | Level 8
wow now I feel really embarrased & stupid...
When I developed this it gave me an error...hence I put the quotation marks around.
Maybe there was something else wrong at that time.

Thnx though.. 😄
ChrisHemedinger
Community Manager

Happens to the best of us 🙂  Glad it's working.

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.

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!

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
  • 1002 views
  • 2 likes
  • 3 in conversation