File permission created within sas

Reply
Contributor
Posts: 32

File permission created within sas

Hi All,

 

I have a sas code , that creates a number of files.

I want all the files should have a permission of 755

read write execute for owner
read and execute for group and others.

 

I am trying to use like below, I am running the code via Putty on Linux OS. I am hoping umask 011 should be able to provide the proper access but it is not happening.

filename in "/export/home/xxxxxx/test.txt";
x "cd /export/home/xxxxxx/";
x "umask 011";
data add;
infile in dsd;
length city $10;
input name $ age city $;
file sysout2;
put _infile_;
run;

 

NOTE: The infile IN is:
Filename=/export/home/a619243/test.txt,
Owner Name=a619243,Group Name=sasfprs,
Access Permission=-rw-r--r--,
Last Modified=01Feb2018:14:36:15,
File Size (bytes)=58

NOTE: The file SYSOUT2 is:
Filename=/home/a619243/sysout2.dat,
Owner Name=a619243,Group Name=sasfprs,
Access Permission=-rw-rw-r--,
Last Modified=14Feb2018:11:26:40

NOTE: 3 records were read from the infile IN.
The minimum record length was 16.
The maximum record length was 20.
NOTE: 3 records were written to the file SYSOUT2.
The minimum record length was 16.
The maximum record length was 20.
NOTE: The data set WORK.ADD has 3 observations and 3 variables.
NOTE: DATA statement used (Total process time):
real time 14.24 seconds
cpu time 0.01 seconds

 

 

Please suggest me best way to achieve it.

 

Thanks,

Suchi

Super User
Posts: 21,527

Re: File permission created within sas

Posted in reply to suchismita

You have to run the program to modify permissions AFTER you create the file. Whatever X command works on the DOS side should work via the X, so if unmask works that will work within SAS.

Contributor
Posts: 32

Re: File permission created within sas

Yes Chmod will work no doubt. 

I will be creating a number of files in different different directories. 

 

If i will use chmod , then I have to use it for each and every file , once the file is created.

I just want something global option , which will  set all the file permissions as 755.

 

Thanks,

Suchi

 

 

Super User
Posts: 21,527

Re: File permission created within sas

Posted in reply to suchismita

I believe files inherit the permissions of the parent folders, can you set it higher up?

 

 

Contributor
Posts: 32

Re: File permission created within sas

Are you saying the parent folder to have 777 permission ?

I do have 777 permission on my parent folder, still umask 011 can not create file with 755 under /export/home/xxxxx .

 

11? x 'ls -ld /export/home/a619243';
drwxrwxrwx. 9 a619243 sasfprs 4096 Feb 13 18:06 /export/home/xxxxx
12?

 

Ask a Question
Discussion stats
  • 4 replies
  • 76 views
  • 0 likes
  • 2 in conversation