Hello, Can someone please help me with this? I am trying to determine patient IDs that are continuously enrolled defined as having at least one claim in each quarter. The dataset year runs from july 2013 to june 2014. What I did/WANT was to divide the year into 4 quarters of three months each and keep patient with at least one claim in each quarter. But manual check of the output dataset revealed that not all patients with this criteria was retained. Sample dataset below: data WORK.SAMPLE2013_2014; infile datalines dsd truncover; input DE_ID:9. SDATE:5. YYYYMMDD:8. LN:$30.; format DE_ID 9. SDATE 5. YYYYMMDD 8.; label DE_ID="DE_ID" SDATE="SDATE" YYYYMMDD="YYYYMMDD" LN="LN"; datalines; 10478 16755 20130715 ACETAMINOPHN 10478 16820 20130918 ACETAMINOPHN 10478 16947 20140123 ACETAMINOPHN 10478 16997 20140314 ACETAMINOPHEN-C 10478 17010 20140327 ACETAMINOPHEN-C 10478 17015 20140401 ACETAMINOPHN 10479 16741 20130701 ACETAMINOPHEN 10479 16741 20130701 HYDRO 10479 16786 20130815 HYDRO 10479 16786 20130815 ACETAMINOPHEN 10479 16811 20130909 HYDRO 10479 16812 20130910 ACETAMINOPHEN 10479 16850 20131018 ACETAMINOPHEN 10479 16850 20131018 HYDRO 10480 16796 20130825 TRA 10480 16825 20130923 TRA 10480 16853 20131021 TRA 10480 16890 20131127 TRA 10480 16907 20131214 TRA 10480 16907 20131214 TRA 10480 16938 20140114 TRA 10480 16958 20140203 TRA 10480 16989 20140306 TRA 10480 17021 20140407 TRA 10480 17045 20140501 TRA 10480 17073 20140529 TRA 10480 17100 20140625 TRA 10485 17030 20140416 HYDRO 10488 16742 20130702 HYDRO 10489 16742 20130702 HYDRO 10489 16777 20130806 HYDRO 10489 16808 20130906 HYDRO 10489 16839 20131007 HYDRO 10489 16868 20131105 HYDRO 10489 16896 20131203 HYDRO 10489 16926 20140102 HYDRO 10489 16949 20140125 HYDRO 10489 16988 20140305 HYDRO 10489 17002 20140319 HYDRO 10489 17028 20140414 HYDRO 10489 17059 20140515 HYDRO 10489 17078 20140603 TRA 10489 17088 20140613 TRA 10489 17088 20140613 HYDRO The code I tried /*Determination of continuous enrollment*/ data Cont_enr1314; set AGEREST1314;qtr= floor(sdate/91.25); run; proc transpose data=Cont_enr1314 out=elig_wide1314 prefix=qtr; by de_id; var qtr;run; data elig_real1314; set elig_wide1314; array qt(*) qtr1-qtr126; do i=1 to 125; if qt(i+1)-qt(i)>1 then delete; end; do i=1 to 126; if qt(i)^=. then qlast=qt(i); end; range=qlast-qt(1); if range<4 then delete; run; /*What was done here was that every patient had to be eligible for at least one month in every quarter over a period of 4 quarters*/ proc sql; create table e_r1314 as select unique elig_real1314.de_id from elig_real1314; quit; Manual check of the data should have retained IDS 10478, 10480, AND 10489. But the output I got with this code only retained ID 10489. Can someone please tell me what is wrong or a more efficient way of doing this. Thank you.
... View more