Thanks for reading this.
I am using a shared service (server=sharedLib) when setting up my libref, to allow users of my SAS/IntrNet application to modify and update (add new) records of a single dataset. The application will also be used to query my dataset. To minimize locking, I am only using a data step to modify and update rather than Proc SQL (which locks the entire member). However, I wonder if locking is more or less likely if only update/modify access to the data uses the share service but queries do not.
%if &type=QUERY %then %do ;
LIBNAME lib '/myServer/library' ;
%end ;
%else %do ;
LIBNAME lib '/myServer/library' server=shareLib ;
%end;
this isn't my actual code, but I do know whether or not the request is going to just send data back or modify an existing record or add a new record (update);
I had originally made this distinction because we were having some failures attaching to the share service (not sure that is the correct terminology), but referencing the lib to query the data did not fail. Since then we have, I think solved this problem, but I wondering if I am setting myself up for problems.
Thanks
Re: Unlocking a locked a Locked dataset The only way to unlock the table is to kill the (SAS-) process locking the table - or to ask the user locking the table to close it.
In Version 7 and Version 8 of SAS/SHARE software, a LOCK statement acquires an exclusive lock on the specified data object (that is a SAS data library, SAS data set, SAS catalog, or SAS catalog entry). No other user can read or write to a data object that you have locked by using the LOCK statement.
This happens when the dataset you are trying to generate is already there and again you are running it to generate it but this time either you or someone else has opened it and it is unable to overwrite the opened dataset.
The maximum length of a data set name is 32 bytes. The first character must be an English letter (A–Z, a–z) or an underscore (_). Subsequent characters can be letters, numeric digits (0, 1, . . ., 9), or underscores. The name cannot contain blank spaces or special characters except for an underscore.
Since your question is more like a request for general advice on data access and concurrency in SAS, my answer will be formed as general advice, more than a specific solution.
There are excellent SAS online documentations. Please go visit the index, and find the information relevant for your further reading.
ACCESS=READONLY
" libname option. It pretty much does what it says, namely restrict access to data members in the libname to be read-only. This holds the benefit that you don't alter your data by accident during a non-altering query. It also enables SAS to leave some room for data altering queries to get higher levels of control over the data.SERVER=SHARELIB
", and have SAS/SHARE manage concurrent data access. If you assign the libname to your SAS/SHARE server process, all subsequent SAS processes needing access to this libname only have to assign the libname like "LIBNAME LIB SERVER=SHARELIB"
(note there is no physical path - the SAS/SHARE server process takes care of that). This setup functions at its best if you have a separate SAS process for your SAS/SHARE server.DATA LIB.MYDATA(CNTLLEV=LIB);
" specifies that access control is at the library level, restricting concurrent access to only one update process to the library. CNTLLEV=MEM
and CNTLLEV=REC
restricts concurrent access at member level and record level respectively.These options can be combined in many different ways, giving a lot of room for you to make access as fine-grained as you need. I hope these choices will help you complete your task.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With