I have a Netezza query where I reference a couple of dates in a series of case statements. Instead of replacing all of these dates every time I'd like to declaire a variable at the beginning and use that throughout the query. In SAS I'd do it like this:
%LET end_p = '31DEC2014'd;
proc sql;
create table want as
select distinct id,
sum(case when (INCUR_DT) >= (&end_p-30)
and ip_op_cd = 'IP'
then net_allow_at else 0 end) as ip_d_30,
sum(case when (INCUR_DT) >= (&end_p-90)
and ip_op_cd = 'IP'
then net_allow_at else 0 end) as ip_d_90,
sum(case when (INCUR_DT) >= (&end_p-180)
and ip_op_cd = 'IP'
then net_allow_at else 0 end) as ip_d_180,
...