Published on :
Général CREATION_INTERNE

Sans titre

This code is also available in: Deutsch Español Français
Attention : This code requires administrator privileges.
Data Analysis

Type : CREATION_INTERNE


The script does not ingest external data for processing. It uses a 'null' DATA STEP for internal operations such as resolving a SAS libref path (`pathname`) and executing system commands (`call system`, `x`).

1 Code Block
MACRO DEFINITION
Explanation :
This block defines the `chmod` macro with two parameters: `path` (libref, default 'inprd') and `local` (local execution indicator). The code includes a conditional block (`%if`) which, if `local` is not specified, uses `%syslput` to transfer the value of `path` and submits the following code to a remote SAS server via `rsubmit`.
Copied!
1%macro chmod(path=inprd,local=) ;
2%put NOTE-USED: {};
3%IF &local= %THEN
4 %DO ;
5 %syslput path=&path;
6 rsubmit ;
7 %END ;
2 Code Block
DATA STEP
Explanation :
This block executes a `_null_` DATA STEP that does not create a dataset. It is used to:
1. Resolve the physical path of the SAS libref (`&path`) using the `pathname()` function.
2. Display this path in the log (`put path=`).
3. Execute the `cd` system command to change the current directory to the resolved path.
Then, it uses two `x` commands to execute the UNIX command `chmod g=rxw *`, first in the libref directory to give the group read, write, and execute permissions, and then in the parent directory (`cd ..`) to apply the same permissions to the containing directory.
Copied!
1 * Fix authorities so group has full access to datasets & indexes created ;
2 * use a datastep to force pathname to resolve on UNIX, rather than windows ;
3 DATA _null_ ;
4 LENGTH path $ 256 ;
5 path=pathname("&path") ;
6 put path= ;
7 call system('cd '||trim(path)) ;
8 RUN ;
9 x "chmod g=rxw *" ;
10 * go up a level to fix the directory ;
11 x "cd .." ;
12 x "chmod g=rxw *" ;
3 Code Block
MACRO END
Explanation :
This block marks the end of the macro. If the code was submitted via `rsubmit` at the beginning of the macro (condition `&local=` true), `endrsubmit` is executed to terminate the remote submission session.
Copied!
1%IF &local= %THEN
2 endrsubmit ; ;
3%mend chmod ;
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.
Copyright Info : Program Macro Name : chmod (version#007) Date : 19feb2004 Written By : phil mason