okay, there is a small thing i am missing here and i think it has to do with the other directory. it is not doing that...the code is wrong there. so what i am trying to do is check if the table exists. the table resides in another directory other than work, in this case, '/sas/dir_01/dir_02/table_&numshortdate' and the numshortdate is a variable that equates to YYYYMM. so if a table with last months date does exist, it copies it to my work directory. if it doesnt exist, it creates one with this months date. simple but i am just missing something about how this is working... %let dsname=/sas/dir_01/dir_02/table_&numshortdate; %macro opends(name); %if %sysfunc(exist(&name)) %then %do; libname LIB01 '/sas/dir_01/dir_02/'; proc copy in=LIB01 out=WORK; select table_&numshortdate; run; %end; %else %do; proc sql; create table table_&lnumshortdate ( YR_MNTH char(6), Col_01 decimal(10,2) format=10.2 informat=10.2, Col_02 decimal(10,2) format=10.2 informat=10.2, Col_03 decimal(10,2) format=10.2 informat=10.2, Col_04 decimal(10,2) format=10.2 informat=10.2); quit; %end; %mend opends; %opends(&dsname);
... View more