BookmarkSubscribeRSS Feed
Tesera
Obsidian | Level 7

Hello, I would like to share code with my colleague, so he can use it, and rerun it when I am out of office. But I can't enter FILELOCK=NONE properly. I haven't found many topics about that online, just basic script which I can't seem to apply to my code.

My shortened code looks like this:  

data S600.PAID (REPLACE=yes); 
length NAME $ 30;
set IACS PRV SOT SP;
created = "%sysfunc(datetime(), datetime19.)";
run;
11 REPLIES 11
Kurt_Bremser
Super User

When you work in a client/server environment, files on the server (including SAS dataset files) belong to the user who writes them. Since the default setting for file access permissions on server systems is so that only the owner can write to those files, another user can't run the same code to replace the dataset.

There are several ways around this, probably depending on operating system used:

  • use a proper umask setting when creating the dataset, so that write permissions are extended for a group (if users share the same group membership)
  • set an ACL (access control list) to allow write permission to a specific user. Since this needs an external command, XCMD must be enabled
  • remove the dataset (using operating system commands) prior to (re)creating it; this also requires XCMD
Tesera
Obsidian | Level 7

Thank you for your ideas. But I dont have many options as I am not administrator of the computer, so I am allowed only to do basic things.

SASKiwi
PROC Star

The FILELOCK option only works on Unix and mainframe  - is your SAS software running on one of these? Assuming you are running on Unix you can use FILELOCK on a LIBNAME statement as documented here: Unix LIBNAME 

Tesera
Obsidian | Level 7

We have Windows in work. I think I will drop the idea of sharing code with my colleague, it seems to complicated for me.

SASKiwi
PROC Star

@Tesera - Do you use a remote SAS server with EG or not? An easy way to tell is if you use an EG connection profile then you have a remote SAS server. If your remote SAS server runs on Unix then FILELOCK is available. 

Tesera
Obsidian | Level 7

Yes, I have to connect to remote server to gain access to libraries in work.

 

So then the code would look like this?:

data S600.PAID (REPLACE=yes);
FILELOCK=NONE; 
length NAME $ 30;
set IACS PRV SOT SP;
created = "%sysfunc(datetime(), datetime19.)";
run;

Because I dont really understand in which part should I use the filelock statement.

Tesera
Obsidian | Level 7

this is whole log: 

1          ;*';*";*/;quit;run;
2          OPTIONS PAGENO=MIN;
3          %LET _CLIENTTASKLABEL='Program (2)';
4          %LET _CLIENTPROCESSFLOWNAME='Process Flow';
5          %LET _CLIENTPROJECTPATH='C:\Users\machova\Desktop\moje sas\Monitoring.egp';
6          %LET _CLIENTPROJECTPATHHOST='PC0800';
7          %LET _CLIENTPROJECTNAME='Monitoring.egp';
8          %LET _SASPROGRAMFILE='';
9          %LET _SASPROGRAMFILEHOST='';
10         
11         ODS _ALL_ CLOSE;
12         OPTIONS DEV=PNG;
13         GOPTIONS XPIXELS=0 YPIXELS=0;
14         FILENAME EGSR TEMP;
15         ODS tagsets.sasreport13(ID=EGSR) FILE=EGSR
16             STYLE=HTMLBlue
17             STYLESHEET=(URL="file:///C:/Program%20Files%20(x86)/SASHome/x86/SASEnterpriseGuide/7.1/Styles/HTMLBlue.css")
18             NOGTITLE
19             NOGFOOTNOTE
20             GPATH=&sasworklocation
21             ENCODING=UTF8
22             options(rolap="on")
23         ;
NOTE: Writing TAGSETS.SASREPORT13(EGSR) Body file: EGSR
24         
25         GOPTIONS ACCESSIBLE;
26         libname s600 list;
NOTE: Libref=   S600 
      Scope=    Object Server
      Engine=   BASE
      Physical Name= M:\SAS\S600
      Filename= M:\SAS\S600
      Owner Name= BUILTIN\Administrators
      File Size=              4KB
      File Size (bytes)= 4096
27         
28         GOPTIONS NOACCESSIBLE;
29         %LET _CLIENTTASKLABEL=;
30         %LET _CLIENTPROCESSFLOWNAME=;
31         %LET _CLIENTPROJECTPATH=;
32         %LET _CLIENTPROJECTPATHHOST=;
33         %LET _CLIENTPROJECTNAME=;
34         %LET _SASPROGRAMFILE=;
35         %LET _SASPROGRAMFILEHOST=;
36         
37         ;*';*";*/;quit;run;
38         ODS _ALL_ CLOSE;
39         
40         
41         QUIT; RUN;
42         
Kurt_Bremser
Super User

So your SAS server runs on Windows, the FILELOCKS system option will not be available. If different users have issues overwriting each other's datasets, check with your SAS and server admins to have the necessary settings changed.

I can't help with this (I wouldn't touch Windows Server with the proverbial ten-foot pole).

Tesera
Obsidian | Level 7

Thank you for your help! I will contact server administrators if it is possible for me. Thank you again!

Kurt_Bremser
Super User

The only thing I was able to find in the documentation regarding FILELOCK is this:

FILELOCKS= System Option on UNIX 

It will only influence the behavior of concurrent SAS sessions, not how access permissions are set for permanent files. This needs to be done with umask settings or the external command chmod (if you actually work on a UNIX system).

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 11 replies
  • 1494 views
  • 0 likes
  • 3 in conversation