BookmarkSubscribeRSS Feed
VijayKumar
Calcite | Level 5


Hi experts,

I execute a data step using enterprise guide.

data newtable;

     set existtab;

          code statement1..

          code statement2...

run;

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...???)

7 REPLIES 7
ballardw
Super User

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

PROC DATASETS LIBRARY=libref MEMTYPE=member-type;
MODIFY member-name (password-level = password-modification);

run;

quit;

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

VijayKumar
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 !

RichardinOz
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

Richard

RichardinOz
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.

Richard

Dhaval12
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;

LinusH
Tourmaline | Level 20
Changing permissions after file creation is awkward. Consider setting default file permissions instead (umask).
Data never sleeps
Dhaval12
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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

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
  • 12676 views
  • 0 likes
  • 5 in conversation