%macro yer(); data DATE_LKUP; MON= month(today()); YR= YEAR(today()); IF MON eq 1 then MONTH= 12; else MONTH = MON -1; IF MON eq 1 then do; Year = YR - 1 ; end; Else do; Year = YR ; end; If MON eq 1 or MON eq 2 or MON eq 3 then YearQuarter= Year || '-Q1'; Else If MON eq 4 or MON eq 5 or MON eq 6 then YearQuarter= Year || '-Q2'; ELSE IF MON eq 7 or MON eq 8 or MON eq 9 then YearQuarter= Year || '-Q3'; ELSE IF MON eq 10 or MON eq 11 or MON eq 12 then YearQuarter= Year || '-Q4'; Year1= Year -1; Year2= Year -2; ReportDATE= Month||'-'||Year; %let Year = Year; %let Year2 = Year2; %let Year1 = Year1; %let Month = Month; %let YearQrt = YearQuarter; %let ReportDATE = ReportDATE; run; %SnapShotDate(&Year,&Month,&YearQrt,3); %SnapShotDate(&Year1,&Month,&YearQrt,2); %SnapShotDate(&Year2,&Month,&YearQrt,1); %BuildExtractFile(&ReportDATE); %mend yer; When I am running this code I am getting below error ERROR: CLI describe error: [Microsoft][SQL Server Native Client 10.0][SQL Server]Invalid column name 'Month'. : [Microsoft][SQL Server Native Client 10.0][SQL Server]Invalid column name 'Year'. : [Microsoft][SQL Server Native Client 10.0][SQL Server]Statement(s) could not be prepared.
... View more