* Windows GetSetFileAttributesA sample code; * Richard A. DeVenezia; * http://www.devenezia.com; filename SASCBTBL catalog 'WORK.WINAPI.GETSETFA.SOURCE'; data _null_; file SASCBTBL; input ; put _infile_; cards4; routine GetFileAttributesA module=KERNEL32 minarg=2 maxarg=2 stackpop=called returns=long ; arg 1 input char format=$cstr200.; * lpFileName; arg 2 output num format=pib4. byvalue; * dwFileAttributes; routine SetFileAttributesA module=KERNEL32 minarg=2 maxarg=2 stackpop=called returns=long ; arg 1 input char format=$cstr200.; * lpFileName; arg 2 input num format=pib4. byvalue; * dwFileAttributes; * attribute flags, can be ORd; * READONLY 01x ; * HIDDEN 02x ; * SYSTEM 04x ; * DIRECTORY 10x ; * ARCHIVE 20x ; * NORMAL 80x ; * TEMPORARY 100x ; * COMPRESSED 800x ; * OFFLINE 1000x ; ;;;; data work.DeleteMe; a=1; run; proc delete data=work.DeleteMe; run; data work.DeleteMe; a=1; run; %let path = %sysfunc (pathname (WORK)); options xwait; x "attrib +r &path.\DeleteMe.*"; proc delete data=work.DeleteMe; run; x "attrib -r &path.\DeleteMe.*"; proc delete data=work.DeleteMe; run; data work.DeleteMe; a=1; run; data _null_; rc = modulen ('SetFileAttributesA', "&path.\DeleteMe.sas7bdat", 01x ) ; run; proc delete data=work.DeleteMe; run; data _null_; rc = modulen ('SetFileAttributesA', "&path.\DeleteMe.sas7bdat", 80x ) ; run; proc delete data=work.DeleteMe; run;