Search code examples
permissionssasdataset

Setting Permission For SAS dataset


I'm new to SAS. I'm wondering if there is a way to ensure all the dataset my SAS program creates have read/write permissions for everyone. Thanks for your help.


Solution

  • There is no Base SAS command that expressly sets the file permissions. However, if your SAS administrator has allowed UNIX commands to be sent to the server, there is a solution.

    SAS has published a sample macro demonstrating the sending of custom operating system commands to set file permission:

    Sample 25198: Macro to change the Unix permissions of a SAS® data set

    Paraphrasing from the link, you'd do something like this:

    filename whatever pipe "chmod 777 /my/data/set/test.sas7bdat";
    
    data _null_;
        file whatever;
     run;
    

    There is also the SAS X command. Such as:

    X "chmod 777 /my/data/set/test.sas7bdat;" , but again, probably forbidden.

    Here are overviews of chmod:

    Change write access permission of dataset in sas

    https://en.wikipedia.org/wiki/Chmod

    As an alternative, you might be able to log onto the SAS file server using an SSH client like putty, and issue the chmod command on the data set.