I am trying to convert the code below into PROC SQL but am stuck. The 'over partition' is not recognized by PROC SQL. Any help would be greatly appreciated. The output would look as follows for one patient: ID_PATIENT DOS_FM DOS_TO ID_PROV PS ICN FLG EPISODE 100001 1/6/2011 1/12/2011 11002 02 1011 1 1 100001 1/12/2011 1/15/2011 11002 06 1012 0 1 100001 1/20/2011 1/28/2011 11002 51 1013 1 2 select a.*, sum(ep_flg)over(partition by id_patient order by dos_from_dt) episode from ( select id_patient, dos_from_dt, dos_to_dt, id_provider_billing, dsc_patient_status, num_icn, case when dos_from_dt-lag(dos_to_dt)over(partition by id_patient order by dos_from_dt) = 0 then 0 else 1 end ep_flg from claim_business cb where dos_from_dt between '01-jan-2011' and '31-jan-2011' ) a Thanks for any help you can give me. I am a newbie.
... View more