BookmarkSubscribeRSS Feed
Calcite | Level 5

Hi experts,

I execute a data step using enterprise guide.

data newtable;

     set existtab;

          code statement1..

          code statement2...


after this data step is it possible to set desired read /write permission for this new table.  (by using sas code only)?

(Like how we change read/write permission of a file with a Unix command on unix prompt  -> chmod 666 filename; similarly can we do that using SAS code...???)

Super User

Proc Datasets with the modify statement may do what you are looking for depending upon the permission you want.

MODIFY member-name (password-level = password-modification);



Password levels are READ=, WRITE=, ALTER= or PW=. The password can be different for each level.

Calcite | Level 5

Thanks Ballardw for your reply...

I looked at PROC DATASETS and I am a bit confused..  as  READ=, WRITE=, ALTER= or PW=.  are for giving passwords...

I will try to make my question more clear..

Suppose I have a dataset XYZ.sas7bdat

On unix system , when I do  ->  ls -ltr XYZ.sas7bdat

I get,

-rw-------       ownername    XYZ.sas7bdat

Now , as per your suggestions , after using PROC datasets, how can I get following ......

-rw-rw-rw-     ownername    XYZ.sas7bdat

Thanks !

Quartz | Level 8

You need to issue the unix chmod command to change permissions, using the SAS X command or one of it's cousins.

From memory it would be something like

X chmod 666 filename ;

which might have to be remote submitted


Quartz | Level 8

But if you are not the owner of the file and the permissions are -rw-------  chmod will fail.  You should talk to you IT guys about changing your user profile to create files with the required permissions.


Fluorite | Level 6

If you do not have permissions andnot the owner unix will not let you write to the file.


SAS code will error.


You may want to use,

filename chmod pipe "chmod 777 /home/source/datasetname.sas7bdat";
data _null_; file chmod; run;

Tourmaline | Level 20
Changing permissions after file creation is awkward. Consider setting default file permissions instead (umask).
Data never sleeps
Fluorite | Level 6
Yes that is also a good idea.
In live environments where we have end users with access to files it may just be helpful to give permissions once the entire job processing is complete.
Wouldn't want someone opening a file in SAS while process is running. May cause job to abend.
So the method you would want to use may be subjective to the type or environment setup and your process.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 7 replies
  • 5 in conversation