When start a new clinical study, the first step is to bulid the folders for programmer users.
you can click the mouse to create the folder and set the folder properties on your PC.
How to set the folder properties through programming under the system of MS windows, and only the owner can change and update his or her own code, others have no right to do.
*******************************************
How to set the folder properties in the code under the system of MS windows
When start a new clinical study, the first step is to bulid the folders for programmer users.
you can click the mouse to create the folder and set the folder properties on your PC, but how to use the code to do those things automatically?
******************************************;
%MACRO SETUP;
%let Sponsor=COMPANY001;
%let Study=STUDY001;
%let root=D:\&Sponsor\&study;
%let PHASE=DRAFT;
%LET QCUSER=TOM;
/*-----------------------------------------------------------------------------
Create folder and Libnames
----------------------------------------------------------------------------*/
options noxwait;
x mkdir "&root\";
x mkdir "&root\0_DOC";
x mkdir "&root\&PHASE";
x mkdir "&root\&PHASE\0_DOC";
x mkdir "&root\&PHASE\PROD";
x mkdir "&root\&PHASE\PROD\ADAM";
x mkdir "&root\&PHASE\PROD\SDTM";
x mkdir "&root\&PHASE\PROD\RAW";
x mkdir "&root\&PHASE\QC";
%if %upcase(&QCUSER) ne %then %do;
x mkdir "&root\&PHASE\QC\&QCUSER\ADaM\";
x mkdir "&root\&PHASE\QC\&QCUSER\Programs\";
x mkdir "&root\&PHASE\QC\&QCUSER\Macros\";
x mkdir "&root\&PHASE\QC\&QCUSER\Output\";
/* How to set the folder properties through programming under the system of MS windows
1.only the owner can change and update his or her own code, others have no right to do*/
libname ADaM "&root\&PHASE\QC\&QCUSER\ADaM\";
libname SDTM "&root\&PHASE\QC\&QCUSER\SDTM\";
libname RAW "&root\&PHASE\QC\&QCUSER\RAW\";
libname Output "&root\&PHASE\QC\&QCUSER\Output\";
%end;
options xwait;
%MEND;
%setup;
A quick Google search that there is a utility in Windows (Server) called icacls that does this.
The X statement (and other SAS means) executes a system command (like mkdir).
icacls is just another system command, so you execute it the same way.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.