SAS Macro to Create a folder using SAS programming
type the folder name you want to be created instead of dir then first compile the ,acro and run the macro.
%macro CheckandCreateDir(dir);
options noxwait;
%local rc fileref ;
%let rc = %sysfunc(filename(fileref,&dir)) ;
%if %sysfunc(fexist(&fileref))
%then
%put The directory "&dir" already exists ;
%else
%do ;
%sysexec mkdir "&dir" ;
%if &sysrc eq 0 %then
%put The directory &dir
has been created. ;
%else %put
There was a problem while creating the directory &dir;
%end ;
%mend CheckandCreateDir ;
Hey Nitin,
ReplyDeletePlease provide me with some basic as well as important questions related to SAS Macros
Here i had a chance to create a folder using a sas program thanks for this information.
ReplyDeleteRegards,
sas training in Chennai
%Macro Verifica_Lib(Libreria,Ruta);
ReplyDeleteData _Null_;
Call Symput('Destino',&Ruta||Compress('&Libreria'));
Run;
%Put &Destino;
%If (%SysFunc(LibRef(&Libreria))) Ne 0 %Then %Do;
%Put Verificando existencia de libreria;
%Put La libreira &Libreria No Existe;
%Put Se procederaa crearla;
Options DLCreateDir;
LibName &Libreria "&Destino";
%End;
%Else %Do;
%Put Verificando existencia de libreria;
%Put La libreira &Libreria existe;
%Put Se continuara el proceso;
%End;
%Error_Sas(Verificacion de Libreria local);
%MEnd Verifica_Lib;