I'm guessing there will be more elegant solutions than this, but here's one way to do it: data have; infile cards dsd; input bep_fisc_yr bep_app_code bep_org_code bep_pgm_ele_code tran_pgm_ele_code end_date$ ; cards; 2009,10,45,34,234,null 2009,10,45,34,234,current 2009,10,45,23,234,null 2009,10,45,34,234,current 2009,10,45,23,234,current 2009,10,45,13,234,null ; run; data want; set have; lbep_f = lag(bep_fisc_yr); lbep_a = lag(bep_app_code); lbep_o = lag(bep_org_code); lbep_p = lag(bep_pgm_ele_code); ltran = lag(tran_pgm_ele_code); if _N_ > 1 then do; if lbep_f ne bep_fisc_yr then lbep_f_c = 1; if lbep_a ne bep_app_code then lbep_a_c = 1; if lbep_o ne bep_org_code then lbep_o_c = 1; if lbep_p ne bep_pgm_ele_code then lbep_p_c = 1; if ltran ne tran_pgm_ele_code then ltran_c = 1; end; if sum(lbep_f_c,lbep_a_c,lbep_o_c,lbep_p_c,ltran_c) < 3 then change = 'No Change'; else change = 'Change'; run;
... View more