Help using Base SAS procedures

macro error

Reply
Super Contributor
Super Contributor
Posts: 444

macro error

running the same macro twice with different arguments and when sas starts executing the second macro  i am  getting this  below:

ERROR: You cannot open WORK.xxx.DATA for output access with member-level control because WORK.xxx.DATA is in use by you

in resource environment Program temp1.sas.

any idea what might be causing this guys?

New Contributor
Posts: 3

Re: macro error

hi

can you give us the code?

Super User
Posts: 5,497

Re: macro error

It sounds like your macro opens the data set, but then fails to close it once it is no longer needed.  So the second run tries to open a data set that is already open.

You'll have to inspect the macro to see where this happens, and add the closing logic at the right spot.

Good luck.

Respected Advisor
Posts: 4,173

Re: macro error

Are you using SAS EG by any chance? If so then make sure that under "Options/Results General" you untick box "Automatically open data or results when generated".

What could happen: Your macro wants to create/write to the same table twice but the table gets opened (and locked) after the first time you touch it.

I also would untick "Options/Data General/Automatically open data when added to project"

And under "Options/SAS Programs" have a tick in "close all open data before running code"

Super Contributor
Super Contributor
Posts: 444

Re: macro error

yes it is EG and  i changed the settings as per your instructions but still same errors. I also checked with other co-workers.They have the same options checked and they can run the code with no errors. It is exactly the same code. When i run the macro separately it works just fine

Ask a Question
Discussion stats
  • 4 replies
  • 279 views
  • 0 likes
  • 4 in conversation