Sample 25198: Macro to change the UNIX permissions of a SASĀ® data set
Click on the Full Code tab for an example that demonstrates how to use a FILENAME statement with the PIPE access method to issue the UNIX chmod command.
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
%macro chmod(libname,dataset,permis=777);
proc sql;
/* get the absolute path of the libname */
select path into: extpath from dictionary.members
where libname="%UPCASE(&LIBNAME)";
/* find out if there are any datasets in the library */
select count(path) into: cnt from dictionary.members
where libname="%UPCASE(&LIBNAME)";
/* if there are datasets...then issue the below command to change the
permissions of the dataset called in this macro to 777 */
%if &cnt > 0 %then %do;
filename chmod pipe "chmod &PERMIS %trim(&extpath)/&dataset..sas7bdat";
data _null_;
file chmod;
run;
%end;
%mend;
/* assign a libref to test the macro */
libname link '/local/u/sssims/sasuser612';
/* test the macro on the 'houses' dataset in the 'link' library */
%chmod(link,houses);
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
Type: | Sample |
Topic: | SAS Reference ==> Macro SAS Reference ==> Procedures ==> SQL System Administration ==> Security ==> Permissions
|
Date Modified: | 2008-06-18 13:34:38 |
Date Created: | 2005-02-10 12:49:52 |
Operating System and Release Information
SAS System | Base SAS | 64-bit Enabled Solaris | n/a | n/a |
64-bit Enabled HP-UX | n/a | n/a |
ABI+ for Intel Architecture | n/a | n/a |
AIX | n/a | n/a |
HP-UX | n/a | n/a |
HP-UX IPF | n/a | n/a |
Linux | n/a | n/a |
Solaris | n/a | n/a |
64-bit Enabled AIX | n/a | n/a |
Tru64 UNIX | n/a | n/a |