Desktop productivity for business analysts and programmers

How to grant and deny access using SAS EG scripts

Reply
New Contributor
Posts: 4

How to grant and deny access using SAS EG scripts

Hi, my system currently uses scripts to run our batch jobs for EG. However we occasionally encounter table locks due to users accessing the tables therefore resulting in batch job failure. During the re-run of batch job from previous point of failure, we will then use SAS Management console to personally deny user access to the respective tables. We are currently working on the codes to be keyed in SAS EG to grant and deny access for our users through the sas scripts but we are encountering error. Can someone please assist me on how to get it started?

 

Keyed in this line of code in SAS EG

 

sas-show-metadata-access -profile Admin /DemoBranch/DemoFolder;

 

Error I got from this line of code is

ERROR 180-322: Statement is not valid or it is used out of proper order.

 

When I keyed in proc sas-show-metadata-access -profile Admin /DemoBranch/DemoFolder;


Error I got from this line of code is

ERROR 22-322: Syntax error, expecting one of the following: ;. AUDIT, CC, CLEANUP.

ERROR 76 -322: Syntax error, statement will be ignored.

 

Thank You.

Valued Guide
Posts: 631

Re: How to grant and deny access using SAS EG scripts

Please post code and log your are executing.

 

Afaik there is no "proc sas-show-metadata-access" - the name violates sas naming rules.

Super User
Posts: 4,030

Re: How to grant and deny access using SAS EG scripts

[ Edited ]

You are trying to run a SAS batch tool as SAS code - it isn't going to work as it designed to be run from an operating system command line:

http://documentation.sas.com/?docsetId=bisecag&docsetTarget=n0bx2mb5l3iosan15odm1wfpo8bn.htm&docsetV...

 

The best way to avoid table locks is to run all of your batch jobs in a production environment where users have read-only access (set up using OS permissions) and this is best done using server-based scheduling.

Super User
Posts: 10,599

Re: How to grant and deny access using SAS EG scripts

@SASKiwi read-only access doesn't really help. Any user who leaves a Viewtable open will block that dataset against writing.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Super User
Posts: 4,030

Re: How to grant and deny access using SAS EG scripts

Posted in reply to KurtBremser

@KurtBremser - agreed VIEWTABLE locks datasets regardless of OS permissions.

Super User
Posts: 10,599

Re: How to grant and deny access using SAS EG scripts

You're thinking much too complicated here. If you have a UNIX server, it is extremely easy to get around locked SAS datasets by removing them first from the filesystem before you write them.

 

Alternatively, set up a time window where all services that could lock datasets (mainly the workspace servers) are stopped, and run your batch processing in that time window.

 

Denying access to a user will not have ANY effect on a SAS session that was started before that. Open files will stay open until they are closed from within the session or the session is terminated.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
New Contributor
Posts: 4

How to grant and deny access in SAS EG through batch jobs

[ Edited ]
Posted in reply to KurtBremser

Hi, my system currently uses scripts to run our batch jobs for EG. However we occasionally encounter table locks due to users accessing the tables therefore resulting in batch job failure. During the re-run of batch job from previous point of failure, we will then use SAS Management console to personally deny user access to the respective tables. We are currently working on the codes to be keyed in SAS EG to grant and deny access for our users through the sas scripts but we are encountering error. Can someone please assist me on how to get it started? 

 

Keyed in this line of code in SAS EG

 

sas-show-metadata-access -profile Admin /DemoBranch/DemoFolder;

 

Error I got from this line of code is

ERROR 180-322: Statement is not valid or it is used out of proper order.

 

When I keyed in proc sas-show-metadata-access -profile Admin /DemoBranch/DemoFolder;

 

Error I got from this line of code is

ERROR 22-322: Syntax error, expecting one of the following: ;. AUDIT, CC, CLEANUP.

ERROR 76 -322: Syntax error, statement will be ignored.

 

Thank You.

Valued Guide
Posts: 631

Re: How to grant and deny access in SAS EG through batch jobs

Why do you repeat your post?

  1. There is no "proc sas-show-metadata-access" - getting an error when trying to execute a non-existing procedure is somehow expectable.
  2. "sas-show-metadata-access" is an executable and part of the SASPlattformObjectFramework, located on the server, depending on you setup, you don't even have it installed on the server hosting the Workspace Server. So maybe you won't be able to execute that executable even if xcmd is turned on.
  3.  @KurtBremser already said: you won't be able to avoid locking of dataset by temporary revoking read-permission.

 


@roth1 wrote:

Hi, my system currently uses scripts to run our batch jobs for EG. However we occasionally encounter table locks due to users accessing the tables therefore resulting in batch job failure. During the re-run of batch job from previous point of failure, we will then use SAS Management console to personally deny user access to the respective tables. We are currently working on the codes to be keyed in SAS EG to grant and deny access for our users through the sas scripts but we are encountering error. Can someone please assist me on how to get it started? 

 

Keyed in this line of code in SAS EG

 

sas-show-metadata-access -profile Admin /DemoBranch/DemoFolder;

 

Error I got from this line of code is

ERROR 180-322: Statement is not valid or it is used out of proper order.

 

When I keyed in proc sas-show-metadata-access -profile Admin /DemoBranch/DemoFolder;

 

Error I got from this line of code is

ERROR 22-322: Syntax error, expecting one of the following: ;. AUDIT, CC, CLEANUP.

ERROR 76 -322: Syntax error, statement will be ignored.

 

Thank You.


 

Super User
Posts: 10,599

Re: How to grant and deny access in SAS EG through batch jobs

[ Edited ]
Posted in reply to andreas_lds

These were originally two separate threads before I merged them. Seems to be an erroneous double-post.

 

PS just happened to me. I hit the "post" button a second time before the "posting success" page started to load.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Ask a Question
Discussion stats
  • 8 replies
  • 193 views
  • 2 likes
  • 4 in conversation