Hi, I'm need to working with SAS date functions any help is appreciated. I'm trying to set two flags in a data set, one for New Customers and one for Existing. New Customers = have an original_purchase_date in the previous month Existing Customers = have an original_purchase_date before previous month And I want to pull in all activity for the last 18 months as of the Last day in the previous month where the Last day in the previous month is %let end='30Jun15'd;run; This is what I have so far and I know this code is incorrect. proc sql; create table Cust as select *, case when original_purchase_date between intnx('MONTH', &end, -1) and intnx('MONTH', &end) then 1 else 0 end as new, case when original_purchase_date lt intnx('MONTH', &end, -1) then 1 else 0 end as Existing from orders where original_purchase_date between intnx('MONTH', &end, -1) and intnx('MONTH', &end, -1) -18; quit; Again, any help is appreciated.
... View more