BookmarkSubscribeRSS Feed
ucvikas
Obsidian | Level 7

Hi SAS Coder,

Scenario of problem - I have one macro say %callme . this macro is called in one sas code say useme.sas . Now I have many SAS jobs which executes useme.sas code based on some parameters. so at a given time many SAS jobs execute useme.sas which inturn has many calls for macro %callme;

macro callme logs some details to one SAS dataset (logging.sas7bdat)like username, time of call etc...  now when many sas jobs execute and call macro CALLME ; then sometimes I get this error "ERROR: The open failed because library member Library.LOGGING.DATA is damaged." . Although I have filelocks option in my SAS code I still get this error.

Strange thing is that dataset LOGGINGis not damaged and I can open it easily; there is no space issues. and once I rerun my code one by one problem does  not appear.

only when there is simultaneous update to dataset LOGGING I get this problem (this is my observation , there could be any other thing which caused this.)

Can any one help me in solving this or point to the cause??

3 REPLIES 3
LinusH
Tourmaline | Level 20

I assume from your description that the macro writes this information to common table (Logging.Data is the same for all calling SAS programs).

I'm not sure about this specific error, but the single user Base SAS engine does not  handle concurrent read/write requests on a record level. To make your writes/updates consistent you need any the following:

  • SAS/SHARE
  • SAS SPD Server
  • External RDBMS
Data never sleeps
ucvikas
Obsidian | Level 7

Hi LinusH

LinusH
Tourmaline | Level 20

Base is per default a single user engine, but it allows for simultaneous read operations. But as soon there is any kind of write/delete/update operation, the whole table is locked for other users, or if there is already a read lock, the update operation will fail.

If %callme is the only client you may add some lock checking within that macro, if not the requires lock is available then insert a wait, and try again. Quite manual, but can work for some applications.

Data never sleeps

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 9652 views
  • 0 likes
  • 2 in conversation